Documentation

BuildSchema
in package

Build instance of `GraphQL\Type\Schema` out of type language definition (string or parsed AST) See [section in docs](type-system/type-language.md) for details.

Table of Contents

$ast  : DocumentNode
$nodeMap  : array<string, TypeDefinitionNode>
$options  : array<string, bool>
$typeConfigDecorator  : callable|null
__construct()  : mixed
build()  : Schema
A helper function to build a GraphQLSchema directly from a source document.
buildAST()  : Schema
This takes the ast of a schema document produced by the parse function in GraphQL\Language\Parser.
buildSchema()  : mixed
getOperationTypes()  : array<string|int, string>

Properties

$typeConfigDecorator

private callable|null $typeConfigDecorator

Methods

__construct()

public __construct(DocumentNode $ast[, callable|null $typeConfigDecorator = null ][, array<string, bool> $options = [] ]) : mixed
Parameters
$ast : DocumentNode
$typeConfigDecorator : callable|null = null
$options : array<string, bool> = []
Return values
mixed

build()

A helper function to build a GraphQLSchema directly from a source document.

public static build(DocumentNode|Source|string $source[, callable|null $typeConfigDecorator = null ][, array<string, bool> $options = [] ]) : Schema
Parameters
$source : DocumentNode|Source|string
$typeConfigDecorator : callable|null = null
$options : array<string, bool> = []
Return values
Schema

buildAST()

This takes the ast of a schema document produced by the parse function in GraphQL\Language\Parser.

public static buildAST(DocumentNode $ast[, callable|null $typeConfigDecorator = null ][, array<string, bool> $options = [] ]) : Schema

If no schema definition is provided, then it will look for types named Query and Mutation.

Given that AST it constructs a GraphQL\Type\Schema. The resulting schema has no resolve methods, so execution will use default resolvers.

Accepts options as a third argument:

  • commentDescriptions: Provide true to use preceding comments as the description. This option is provided to ease adoption and will be removed in v16.
Parameters
$ast : DocumentNode
$typeConfigDecorator : callable|null = null
$options : array<string, bool> = []
Tags
throws
Error
Return values
Schema

buildSchema()

public buildSchema() : mixed
Return values
mixed

Search results