WooCommerce Code Reference

BuildClientSchema
in package

Tags
phpstan-import-type

UnnamedFieldDefinitionConfig from FieldDefinition

phpstan-import-type

UnnamedInputObjectFieldConfig from InputObjectField

phpstan-type

Options array{ assumeValid?: bool }

  • assumeValid: When building a schema from a Automattic\WooCommerce\Vendor\GraphQL service's introspection result, it might be safe to assume the schema is valid. Set to true to assume the produced schema is valid.

    Default: false
    
see
BuildClientSchemaTest

Table of Contents

$introspection  : array<string|int, mixed>
$options  : array<string|int, mixed>
$typeMap  : array<string|int, mixed>
__construct()  : mixed
build()  : Schema
Build a schema for use by client tools.
buildDirective()  : Directive
buildInputValue()  : UnnamedInputObjectFieldConfig
buildSchema()  : Schema
getInterfaceType()  : InterfaceType
invalidOrIncompleteIntrospectionResult()  : InvariantViolation
buildEnumDef()  : EnumType
buildFieldDefMap()  : array<string, UnnamedFieldDefinitionConfig>
buildImplementationsList()  : array<int, InterfaceType>
buildInputObjectDef()  : InputObjectType
buildInputValueDefMap()  : array<string, UnnamedInputObjectFieldConfig>
buildInterfaceDef()  : InterfaceType
buildObjectDef()  : ObjectType
buildScalarDef()  : ScalarType
buildType()  : Type|NamedType
buildUnionDef()  : UnionType
getInputType()  : Type|InputType
getNamedType()  : NamedType|Type
getObjectType()  : ObjectType
getOutputType()  : OutputType
getType()  : Type

Properties

Methods

__construct()

public __construct(array<string, mixed> $introspectionQuery[, array<string, bool> $options = [] ]) : mixed
Parameters
$introspectionQuery : array<string, mixed>
$options : array<string, bool> = []
Tags
phpstan-param

Options $options

Return values
mixed

build()

Build a schema for use by client tools.

public static build(array<string, mixed> $introspectionQuery[, array<string, bool> $options = [] ]) : Schema

Given the result of a client running the introspection query, creates and returns a \Automattic\WooCommerce\Vendor\GraphQL\Type\Schema instance which can be then used with all graphql-php tools, but cannot be used to execute a query, as introspection does not represent the "resolver", "parse" or "serialize" functions or any other server-internal mechanisms.

This function expects a complete introspection result. Don't forget to check the "errors" field of a server response before calling this function.

Parameters
$introspectionQuery : array<string, mixed>
$options : array<string, bool> = []
Tags
phpstan-param

Options $options

throws
Exception
throws
InvariantViolation
Return values
Schema

buildInputValue()

public buildInputValue(array<string, mixed> $inputValueIntrospection) : UnnamedInputObjectFieldConfig
Parameters
$inputValueIntrospection : array<string, mixed>
Tags
throws
Exception
throws
SyntaxError
Return values
UnnamedInputObjectFieldConfig

buildFieldDefMap()

private buildFieldDefMap(array<string, mixed> $typeIntrospection) : array<string, UnnamedFieldDefinitionConfig>
Parameters
$typeIntrospection : array<string, mixed>
Tags
throws
Exception
throws
InvariantViolation
Return values
array<string, UnnamedFieldDefinitionConfig>

buildInputValueDefMap()

private buildInputValueDefMap(array<int, array<string, mixed>> $inputValueIntrospections) : array<string, UnnamedInputObjectFieldConfig>
Parameters
$inputValueIntrospections : array<int, array<string, mixed>>
Tags
throws
Exception
Return values
array<string, UnnamedInputObjectFieldConfig>