You are here

private function Validator::getSchemaPlugin in GraphQL 8.4

Get the schema plugin for a GraphQL server.

Parameters

\Drupal\graphql\Entity\ServerInterface $server: The GraphQL server.

Return value

\Drupal\graphql\Plugin\SchemaPluginInterface A schema plugin interface.

Throws

\Drupal\Component\Plugin\Exception\PluginException Thrown when no schema plugin is defined for the server.

3 calls to Validator::getSchemaPlugin()
Validator::getMissingResolvers in src/GraphQL/Validator.php
Get a list of missing resolvers.
Validator::getOrphanedResolvers in src/GraphQL/Validator.php
Get a list of orphaned resolvers.
Validator::validateSchema in src/GraphQL/Validator.php
Validates the schema of the server.

File

src/GraphQL/Validator.php, line 195

Class

Validator
GraphQL validation service.

Namespace

Drupal\graphql\GraphQL

Code

private function getSchemaPlugin(ServerInterface $server) : SchemaPluginInterface {
  $schema_name = $server
    ->get('schema');

  /** @var \Drupal\graphql\Plugin\SchemaPluginInterface $plugin */
  $plugin = $this->pluginManager
    ->createInstance($schema_name);
  if ($plugin instanceof ConfigurableInterface && ($config = $server
    ->get('schema_configuration'))) {
    $plugin
      ->setConfiguration($config[$schema_name] ?? []);
  }
  return $plugin;
}