FieldsOnCorrectType
extends ValidationRule
in package
Table of Contents
- $name : string
- __invoke() : mixed
- getName() : mixed
- getSDLVisitor() : array<string|int, mixed>
- Returns structure suitable for GraphQL\Language\Visitor
- getVisitor() : array<string|int, mixed>
- Returns structure suitable for GraphQL\Language\Visitor
- undefinedFieldMessage() : string
- getSuggestedFieldNames() : array<string|int, mixed>|array<string|int, string>
- For the field name provided, determine if there are any similar field names that may be the result of a typo.
- getSuggestedTypeNames() : array<string|int, string>
- Go through all of the implementations of type, as well as the interfaces that they implement. If any of those types include the provided field, suggest them, sorted by how often the type is referenced, starting with Interfaces.
Properties
$name
protected
string
$name
Methods
__invoke()
public
__invoke(ValidationContext $context) : mixed
Parameters
- $context : ValidationContext
Return values
mixed —getName()
public
getName() : mixed
Return values
mixed —getSDLVisitor()
Returns structure suitable for GraphQL\Language\Visitor
public
getSDLVisitor(SDLValidationContext $context) : array<string|int, mixed>
Parameters
- $context : SDLValidationContext
Tags
Return values
array<string|int, mixed> —getVisitor()
Returns structure suitable for GraphQL\Language\Visitor
public
getVisitor(ValidationContext $context) : array<string|int, mixed>
Parameters
- $context : ValidationContext
Return values
array<string|int, mixed> —undefinedFieldMessage()
public
static undefinedFieldMessage(string $fieldName, string $type, array<string|int, string> $suggestedTypeNames, array<string|int, string> $suggestedFieldNames) : string
Parameters
- $fieldName : string
- $type : string
- $suggestedTypeNames : array<string|int, string>
- $suggestedFieldNames : array<string|int, string>
Return values
string —getSuggestedFieldNames()
For the field name provided, determine if there are any similar field names that may be the result of a typo.
private
getSuggestedFieldNames(Schema $schema, ObjectType|InterfaceType $type, string $fieldName) : array<string|int, mixed>|array<string|int, string>
Parameters
- $schema : Schema
- $type : ObjectType|InterfaceType
- $fieldName : string
Return values
array<string|int, mixed>|array<string|int, string> —getSuggestedTypeNames()
Go through all of the implementations of type, as well as the interfaces that they implement. If any of those types include the provided field, suggest them, sorted by how often the type is referenced, starting with Interfaces.
private
getSuggestedTypeNames(Schema $schema, ObjectType|InterfaceType $type, string $fieldName) : array<string|int, string>
Parameters
- $schema : Schema
- $type : ObjectType|InterfaceType
- $fieldName : string