You are here

public function Validator::validateSchema in GraphQL 8.4

Validates the schema of the server.

Parameters

\Drupal\graphql\Entity\ServerInterface $server: The server to validate.

Return value

\GraphQL\Error\Error[] An array of validation errors.

Overrides ValidatorInterface::validateSchema

File

src/GraphQL/Validator.php, line 47

Class

Validator
GraphQL validation service.

Namespace

Drupal\graphql\GraphQL

Code

public function validateSchema(ServerInterface $server) : array {
  $plugin = $this
    ->getSchemaPlugin($server);
  try {
    return $plugin
      ->getSchema($plugin
      ->getResolverRegistry())
      ->validate();
  } catch (Error $e) {
    return [
      $e,
    ];
  }
}