You are here

Introspection.php in GraphQL 8.4

Same filename and directory in other branches
  1. 8.3 src/GraphQL/Utility/Introspection.php

File

src/GraphQL/Utility/Introspection.php
View source
<?php

namespace Drupal\graphql\GraphQL\Utility;

use Drupal\graphql\Entity\ServerInterface;
use GraphQL\Server\OperationParams;
use GraphQL\Type\Introspection as IntrospectionType;

/**
 * Runs introspection queries against a GraphQL server.
 */
class Introspection {

  /**
   * Perform an introspection query and return result.
   *
   * @param \Drupal\graphql\Entity\ServerInterface $server
   *   The server instance.
   *
   * @return array
   *   The introspection result as an array.
   */
  public function introspect(ServerInterface $server) {
    $operation = new OperationParams();
    $operation->query = IntrospectionType::getIntrospectionQuery([
      'descriptions' => TRUE,
    ]);
    $result = $server
      ->executeOperation($operation);
    return $result
      ->toArray();
  }

}

Classes

Namesort descending Description
Introspection Runs introspection queries against a GraphQL server.