You are here

trait SchemaPrinterTrait in GraphQL 8.4

Trait to get printed version of the schema.

Hierarchy

1 file declares its use of SchemaPrinterTrait
GraphQLTestBase.php in tests/src/Kernel/GraphQLTestBase.php

File

tests/src/Traits/SchemaPrinterTrait.php, line 11

Namespace

Drupal\Tests\graphql\Traits
View source
trait SchemaPrinterTrait {

  /**
   * Gets printed version of the schema.
   *
   * @param \Drupal\graphql\Entity\ServerInterface $server
   *   The server id.
   *
   * @return string
   *   The printed version of the schema.
   */
  protected function getPrintedSchema(ServerInterface $server = NULL) {
    $server = $server ?? $this->server;

    /** @var \GraphQL\Server\ServerConfig $config */
    $config = $server
      ->configuration();
    $schema = $config
      ->getSchema();
    return SchemaPrinter::doPrint($schema);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SchemaPrinterTrait::getPrintedSchema protected function Gets printed version of the schema.