Introspection.php in GraphQL 8.3
File
src/GraphQL/Utility/Introspection.php
View source
<?php
namespace Drupal\graphql\GraphQL\Utility;
use Drupal\graphql\GraphQL\Execution\QueryProcessor;
use GraphQL\Server\OperationParams;
use GraphQL\Type\Introspection as IntrospectionType;
class Introspection {
protected $queryProcessor;
public function __construct(QueryProcessor $queryProcessor) {
$this->queryProcessor = $queryProcessor;
}
public function introspect($schema) {
$query = IntrospectionType::getIntrospectionQuery([
'descriptions' => TRUE,
]);
$operation = OperationParams::create([
'query' => $query,
]);
$result = $this->queryProcessor
->processQuery($schema, $operation);
return $result
->toArray();
}
}