C# Class GraphQL.Validation.Rules.FieldsOnCorrectType

Fields on correct type A GraphQL document is only valid if all fields selected are defined by the parent type, or are an allowed meta field such as __typename
Inheritance: IValidationRule
Exibir arquivo Open project: graphql-dotnet/graphql-dotnet

Public Methods

Method Description
UndefinedFieldMessage ( string fieldName, string type, IEnumerable suggestedTypeNames, IEnumerable suggestedFieldNames ) : string
Validate ( ValidationContext context ) : INodeVisitor

Private Methods

Method Description
getSuggestedFieldNames ( IGraphType type, string fieldName ) : IEnumerable

For the field name provided, determine if there are any similar field names that may be the result of a typo.

getSuggestedTypeNames ( ISchema schema, IGraphType type, string fieldName ) : IEnumerable

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.

Method Details

UndefinedFieldMessage() public method

public UndefinedFieldMessage ( string fieldName, string type, IEnumerable suggestedTypeNames, IEnumerable suggestedFieldNames ) : string
fieldName string
type string
suggestedTypeNames IEnumerable
suggestedFieldNames IEnumerable
return string

Validate() public method

public Validate ( ValidationContext context ) : INodeVisitor
context ValidationContext
return INodeVisitor