Skip to content

GqlInputSchema ​

Type
Class
Namespace
craft\gql
Inherits
craft\gql\GqlInputSchema
Since
5.12.0

Describes the values GraphQL input types accept as JSON schemas.

View source

Public Methods ​

MethodDescription
fromType()Returns the JSON schema of the values a GraphQL input type accepts.
withNull()Returns a schema that also accepts null.
withoutNull()Returns a schema that doesn’t accept null.

fromType() ​

Returns the JSON schema of the values a GraphQL input type accepts.

Input object types with an isOneOf config value accept exactly one of their fields. Input object fields with an inputSchema config value accept the values that schema describes, rather than the ones their type does.

View source

Arguments ​

  • $definition (\GraphQL\Type\Definition\Type, array<string,mixed>) – A type, or a field definition with a type and an optional description.

Returns ​

array<string,mixed>

withNull() ​

Returns a schema that also accepts null.

View source

Arguments ​

  • $schema (array<string,mixed>)

Returns ​

array<string,mixed>

withoutNull() ​

Returns a schema that doesn’t accept null.

View source

Arguments ​

  • $schema (array<string,mixed>)

Returns ​

array<string,mixed>