You are here

class Introspection in GraphQL 8.3

Same name and namespace in other branches
  1. 8.4 src/GraphQL/Utility/Introspection.php \Drupal\graphql\GraphQL\Utility\Introspection

Hierarchy

Expanded class hierarchy of Introspection

2 files declare their use of Introspection
ExplorerController.php in src/Controller/ExplorerController.php
VoyagerController.php in src/Controller/VoyagerController.php
1 string reference to 'Introspection'
graphql.services.yml in ./graphql.services.yml
graphql.services.yml
1 service uses Introspection
graphql.introspection in ./graphql.services.yml
Drupal\graphql\GraphQL\Utility\Introspection

File

src/GraphQL/Utility/Introspection.php, line 9

Namespace

Drupal\graphql\GraphQL\Utility
View source
class Introspection {

  /**
   * @var \Drupal\graphql\GraphQL\Execution\QueryProcessor
   */
  protected $queryProcessor;

  /**
   * Constructs an Introspection object.
   *
   * @param \Drupal\graphql\GraphQL\Execution\QueryProcessor $queryProcessor
   *   The query processor srevice.
   */
  public function __construct(QueryProcessor $queryProcessor) {
    $this->queryProcessor = $queryProcessor;
  }

  /**
   * Perform an introspection query and return result.
   *
   * @param string $schema
   *   The name of the graphql schema to introspect.
   *
   * @return array The introspection result as an array.
   *   The introspection result as an array.
   */
  public function introspect($schema) {
    $query = IntrospectionType::getIntrospectionQuery([
      'descriptions' => TRUE,
    ]);
    $operation = OperationParams::create([
      'query' => $query,
    ]);
    $result = $this->queryProcessor
      ->processQuery($schema, $operation);
    return $result
      ->toArray();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Introspection::$queryProcessor protected property
Introspection::introspect public function Perform an introspection query and return result.
Introspection::__construct public function Constructs an Introspection object.