py_gql.validation.rules#

Validation rules defined in this section of the specification.

These rules are all used by default when calling ~py_gql.validation.validate and accessible together as ~py_gql.validatin.SPECIFIED_RULES.

class py_gql.validation.rules.OverlappingFieldsCanBeMergedChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A selection set is only valid if all fields (including spreading any fragments) either correspond to distinct response names or can be merged without ambiguity.

class py_gql.validation.rules.ValuesOfCorrectTypeChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is only valid if all value literals are of the type expected at their position.

class py_gql.validation.rules.ExecutableDefinitionsChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is only valid for execution if all definitions are either operation or fragment definitions.

Unnecessary if parser was run with allow_type_system=False.

class py_gql.validation.rules.UniqueOperationNameChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is only valid if all defined operations have unique names.

class py_gql.validation.rules.LoneAnonymousOperationChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is only valid if when it contains an anonymous operation (the query short-hand) that it contains only that one operation definition.

class py_gql.validation.rules.SingleFieldSubscriptionsChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL subscription is valid only if it contains a single root field.

class py_gql.validation.rules.KnownTypeNamesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is only valid if referenced types (specifically variable definitions and fragment conditions) are defined by the type schema.

class py_gql.validation.rules.FragmentsOnCompositeTypesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

Fragments use a type condition to determine if they apply, since fragments can only be spread into a composite type (object, interface, or union), the type condition must also be a composite type.

class py_gql.validation.rules.VariablesAreInputTypesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL operation is only valid if all the variables it defines are of input types (scalar, enum, or input object).

class py_gql.validation.rules.ScalarLeafsChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is valid only if all leaf fields (fields without sub selections) are of scalar or enum types.

class py_gql.validation.rules.FieldsOnCorrectTypeChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

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.

class py_gql.validation.rules.UniqueFragmentNamesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is only valid if all defined fragments have unique names.

class py_gql.validation.rules.KnownFragmentNamesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is only valid if all …Fragment fragment spreads refer to fragments defined in the same document.

class py_gql.validation.rules.NoUnusedFragmentsChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is only valid if all fragment definitions are spread within operations, or spread within other fragments spread within operations.

class py_gql.validation.rules.PossibleFragmentSpreadsChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A fragment spread is only valid if the type condition could ever possibly be true: if there is a non-empty intersection of the possible parent types, and possible types which pass the type condition.

class py_gql.validation.rules.NoFragmentCyclesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL Document is only valid if fragment definitions are not cyclic.

class py_gql.validation.rules.UniqueVariableNamesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL operation is only valid if all its variables are uniquely named.

class py_gql.validation.rules.NoUndefinedVariablesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.VariablesCollector

A GraphQL operation is only valid if all variables encountered, both directly and via fragment spreads, are defined by that operation.

class py_gql.validation.rules.NoUnusedVariablesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.VariablesCollector

A GraphQL operation is only valid if all variables defined by an operation are used, either directly or within a spread fragment.

class py_gql.validation.rules.KnownDirectivesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is only valid if all @directives are known by the schema and legally positioned.

class py_gql.validation.rules.UniqueDirectivesPerLocationChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL document is only valid if all directives at a given location are uniquely named.

class py_gql.validation.rules.KnownArgumentNamesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL field / directive is only valid if all supplied arguments are defined by that field / directive.

class py_gql.validation.rules.UniqueArgumentNamesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL field or directive is only valid if all supplied arguments are uniquely named.

class py_gql.validation.rules.ProvidedRequiredArgumentsChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A field or directive is only valid if all required (non-null without a default value) ) field arguments have been provided.

class py_gql.validation.rules.VariablesInAllowedPositionChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.VariablesCollector

Variables passed to field arguments conform to type

class py_gql.validation.rules.UniqueInputFieldNamesChecker(schema, type_info)[source]#

Bases: py_gql.validation.visitors.ValidationVisitor

A GraphQL input object value is only valid if all supplied fields are uniquely named.