diff --git a/tstypes/validation/ValidationContext.d.ts b/tstypes/validation/ValidationContext.d.ts index 1576bdc64e..b98c947b7f 100644 --- a/tstypes/validation/ValidationContext.d.ts +++ b/tstypes/validation/ValidationContext.d.ts @@ -1,5 +1,6 @@ import Maybe from '../tsutils/Maybe'; import { GraphQLError } from '../error'; +import { ASTVisitor } from '../language/visitor'; import { DocumentNode, OperationDefinitionNode, @@ -9,6 +10,7 @@ import { FragmentDefinitionNode, } from '../language/ast'; import { GraphQLSchema } from '../type/schema'; +import { GraphQLDirective } from '../type/directives'; import { GraphQLInputType, GraphQLOutputType, @@ -16,9 +18,7 @@ import { GraphQLField, GraphQLArgument, } from '../type/definition'; -import { GraphQLDirective } from '../type/directives'; import { TypeInfo } from '../utilities/TypeInfo'; -import { ASTVisitor } from '../language/visitor'; type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; type VariableUsage = { @@ -40,10 +40,22 @@ export class ASTValidationContext { getErrors(): ReadonlyArray; getDocument(): DocumentNode; + + getFragment(name: string): Maybe; + + getFragmentSpreads(node: SelectionSetNode): ReadonlyArray; + + getRecursivelyReferencedFragments( + operation: OperationDefinitionNode, + ): ReadonlyArray; } export class SDLValidationContext extends ASTValidationContext { - constructor(ast: DocumentNode, schema?: Maybe); + constructor( + ast: DocumentNode, + schema: Maybe, + onError?: (err: GraphQLError) => void, + ); getSchema(): Maybe; } @@ -51,24 +63,21 @@ export class SDLValidationContext extends ASTValidationContext { export type SDLValidationRule = (context: SDLValidationContext) => ASTVisitor; export class ValidationContext extends ASTValidationContext { - constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo); + constructor( + schema: GraphQLSchema, + ast: DocumentNode, + typeInfo: TypeInfo, + onError?: (err: GraphQLError) => void, + ); getSchema(): GraphQLSchema; - getFragment(name: string): Maybe; - - getFragmentSpreads(node: SelectionSetNode): ReadonlyArray; + getVariableUsages(node: NodeWithSelectionSet): ReadonlyArray; getRecursivelyReferencedFragments( operation: OperationDefinitionNode, ): ReadonlyArray; - getVariableUsages(node: NodeWithSelectionSet): ReadonlyArray; - - getRecursiveVariableUsages( - operation: OperationDefinitionNode, - ): ReadonlyArray; - getType(): Maybe; getParentType(): Maybe; diff --git a/tstypes/validation/rules/ExecutableDefinitions.d.ts b/tstypes/validation/rules/ExecutableDefinitions.d.ts index 055bca6e63..e079dea2f0 100644 --- a/tstypes/validation/rules/ExecutableDefinitions.d.ts +++ b/tstypes/validation/rules/ExecutableDefinitions.d.ts @@ -1,5 +1,5 @@ -import { ASTValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ASTValidationContext } from '../ValidationContext'; export function nonExecutableDefinitionMessage(defName: string): string; diff --git a/tstypes/validation/rules/FieldsOnCorrectType.d.ts b/tstypes/validation/rules/FieldsOnCorrectType.d.ts index 38ba3ed846..130cb83d13 100644 --- a/tstypes/validation/rules/FieldsOnCorrectType.d.ts +++ b/tstypes/validation/rules/FieldsOnCorrectType.d.ts @@ -1,5 +1,12 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; + +export function undefinedFieldMessage( + fieldName: string, + type: string, + suggestedTypeNames: ReadonlyArray, + suggestedFieldNames: ReadonlyArray, +): string; /** * Fields on correct type diff --git a/tstypes/validation/rules/FragmentsOnCompositeTypes.d.ts b/tstypes/validation/rules/FragmentsOnCompositeTypes.d.ts index f2da30fd00..32bd7c7f7d 100644 --- a/tstypes/validation/rules/FragmentsOnCompositeTypes.d.ts +++ b/tstypes/validation/rules/FragmentsOnCompositeTypes.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function inlineFragmentOnNonCompositeErrorMessage(type: string): string; diff --git a/tstypes/validation/rules/KnownArgumentNames.d.ts b/tstypes/validation/rules/KnownArgumentNames.d.ts index 208f919302..e3869ca72e 100644 --- a/tstypes/validation/rules/KnownArgumentNames.d.ts +++ b/tstypes/validation/rules/KnownArgumentNames.d.ts @@ -5,13 +5,13 @@ export function unknownArgMessage( argName: string, fieldName: string, typeName: string, - suggestedArgs: Array, + suggestedArgs: ReadonlyArray, ): string; export function unknownDirectiveArgMessage( argName: string, directiveName: string, - suggestedArgs: Array, + suggestedArgs: ReadonlyArray, ): string; /** diff --git a/tstypes/validation/rules/KnownDirectives.d.ts b/tstypes/validation/rules/KnownDirectives.d.ts index 8585a80737..ecff9172a2 100644 --- a/tstypes/validation/rules/KnownDirectives.d.ts +++ b/tstypes/validation/rules/KnownDirectives.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext, SDLValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext, SDLValidationContext } from '../ValidationContext'; export function unknownDirectiveMessage(directiveName: string): string; diff --git a/tstypes/validation/rules/KnownFragmentNames.d.ts b/tstypes/validation/rules/KnownFragmentNames.d.ts index 14168e2348..0f91fd895a 100644 --- a/tstypes/validation/rules/KnownFragmentNames.d.ts +++ b/tstypes/validation/rules/KnownFragmentNames.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function unknownFragmentMessage(fragName: string): string; diff --git a/tstypes/validation/rules/KnownTypeNames.d.ts b/tstypes/validation/rules/KnownTypeNames.d.ts index d720269f9b..cc8280db0f 100644 --- a/tstypes/validation/rules/KnownTypeNames.d.ts +++ b/tstypes/validation/rules/KnownTypeNames.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function unknownTypeMessage( typeName: string, diff --git a/tstypes/validation/rules/LoneAnonymousOperation.d.ts b/tstypes/validation/rules/LoneAnonymousOperation.d.ts index 345966ad7d..ed1ce2505b 100644 --- a/tstypes/validation/rules/LoneAnonymousOperation.d.ts +++ b/tstypes/validation/rules/LoneAnonymousOperation.d.ts @@ -1,5 +1,5 @@ -import { ASTValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ASTValidationContext } from '../ValidationContext'; export function anonOperationNotAloneMessage(): string; diff --git a/tstypes/validation/rules/LoneSchemaDefinition.d.ts b/tstypes/validation/rules/LoneSchemaDefinition.d.ts index c2084bb5eb..fab68bee8d 100644 --- a/tstypes/validation/rules/LoneSchemaDefinition.d.ts +++ b/tstypes/validation/rules/LoneSchemaDefinition.d.ts @@ -1,5 +1,5 @@ -import { SDLValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { SDLValidationContext } from '../ValidationContext'; export function schemaDefinitionNotAloneMessage(): string; diff --git a/tstypes/validation/rules/NoFragmentCycles.d.ts b/tstypes/validation/rules/NoFragmentCycles.d.ts index 98e9051722..80eff89fa6 100644 --- a/tstypes/validation/rules/NoFragmentCycles.d.ts +++ b/tstypes/validation/rules/NoFragmentCycles.d.ts @@ -1,9 +1,9 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function cycleErrorMessage( fragName: string, - spreadNames: Array, + spreadNames: ReadonlyArray, ): string; export function NoFragmentCycles(context: ValidationContext): ASTVisitor; diff --git a/tstypes/validation/rules/NoUndefinedVariables.d.ts b/tstypes/validation/rules/NoUndefinedVariables.d.ts index a8bd4d9d95..54797d3d6c 100644 --- a/tstypes/validation/rules/NoUndefinedVariables.d.ts +++ b/tstypes/validation/rules/NoUndefinedVariables.d.ts @@ -1,6 +1,6 @@ import Maybe from '../../tsutils/Maybe'; -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function undefinedVarMessage( varName: string, diff --git a/tstypes/validation/rules/NoUnusedFragments.d.ts b/tstypes/validation/rules/NoUnusedFragments.d.ts index be44a0cb83..8c9631e8bd 100644 --- a/tstypes/validation/rules/NoUnusedFragments.d.ts +++ b/tstypes/validation/rules/NoUnusedFragments.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function unusedFragMessage(fragName: string): string; diff --git a/tstypes/validation/rules/NoUnusedVariables.d.ts b/tstypes/validation/rules/NoUnusedVariables.d.ts index 4d2c9be1c8..055faa1145 100644 --- a/tstypes/validation/rules/NoUnusedVariables.d.ts +++ b/tstypes/validation/rules/NoUnusedVariables.d.ts @@ -1,6 +1,6 @@ import Maybe from '../../tsutils/Maybe'; -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function unusedVariableMessage( varName: string, diff --git a/tstypes/validation/rules/OverlappingFieldsCanBeMerged.d.ts b/tstypes/validation/rules/OverlappingFieldsCanBeMerged.d.ts index 1288ed1da7..b581ee9c43 100644 --- a/tstypes/validation/rules/OverlappingFieldsCanBeMerged.d.ts +++ b/tstypes/validation/rules/OverlappingFieldsCanBeMerged.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function fieldsConflictMessage( responseName: string, diff --git a/tstypes/validation/rules/PossibleFragmentSpreads.d.ts b/tstypes/validation/rules/PossibleFragmentSpreads.d.ts index 1623fc41d8..cd1a3fc074 100644 --- a/tstypes/validation/rules/PossibleFragmentSpreads.d.ts +++ b/tstypes/validation/rules/PossibleFragmentSpreads.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function typeIncompatibleSpreadMessage( fragName: string, diff --git a/tstypes/validation/rules/PossibleTypeExtensions.d.ts b/tstypes/validation/rules/PossibleTypeExtensions.d.ts new file mode 100644 index 0000000000..0bb4328f19 --- /dev/null +++ b/tstypes/validation/rules/PossibleTypeExtensions.d.ts @@ -0,0 +1,21 @@ +import { ASTVisitor } from '../../language/visitor'; +import { SDLValidationContext } from '../ValidationContext'; + +export function extendingUnknownTypeMessage( + typeName: string, + suggestedTypes: $ReadOnlyArray, +): string; + +export function extendingDifferentTypeKindMessage( + typeName: string, + kind: string, +): string; + +/** + * Possible type extension + * + * A type extension is only valid if the type is defined and has the same kind. + */ +export function PossibleTypeExtensions( + context: SDLValidationContext, +): ASTVisitor; diff --git a/tstypes/validation/rules/ProvidedRequiredArguments.d.ts b/tstypes/validation/rules/ProvidedRequiredArguments.d.ts index a7382f2af7..c1bc4c4683 100644 --- a/tstypes/validation/rules/ProvidedRequiredArguments.d.ts +++ b/tstypes/validation/rules/ProvidedRequiredArguments.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext, SDLValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext, SDLValidationContext } from '../ValidationContext'; export function missingFieldArgMessage( fieldName: string, diff --git a/tstypes/validation/rules/ScalarLeafs.d.ts b/tstypes/validation/rules/ScalarLeafs.d.ts index c16d923811..f01448beef 100644 --- a/tstypes/validation/rules/ScalarLeafs.d.ts +++ b/tstypes/validation/rules/ScalarLeafs.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function noSubselectionAllowedMessage( fieldName: string, diff --git a/tstypes/validation/rules/SingleFieldSubscriptions.d.ts b/tstypes/validation/rules/SingleFieldSubscriptions.d.ts index 8e3d56c3b1..7dbbb23cf3 100644 --- a/tstypes/validation/rules/SingleFieldSubscriptions.d.ts +++ b/tstypes/validation/rules/SingleFieldSubscriptions.d.ts @@ -1,6 +1,6 @@ import Maybe from '../../tsutils/Maybe'; -import { ASTValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ASTValidationContext } from '../ValidationContext'; export function singleFieldOnlyMessage(name: Maybe): string; diff --git a/tstypes/validation/rules/UniqueArgumentNames.d.ts b/tstypes/validation/rules/UniqueArgumentNames.d.ts index f0b4d4adc2..fdd51e1020 100644 --- a/tstypes/validation/rules/UniqueArgumentNames.d.ts +++ b/tstypes/validation/rules/UniqueArgumentNames.d.ts @@ -1,5 +1,5 @@ -import { ASTValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ASTValidationContext } from '../ValidationContext'; export function duplicateArgMessage(argName: string): string; diff --git a/tstypes/validation/rules/UniqueDirectiveNames.d.ts b/tstypes/validation/rules/UniqueDirectiveNames.d.ts new file mode 100644 index 0000000000..3490938491 --- /dev/null +++ b/tstypes/validation/rules/UniqueDirectiveNames.d.ts @@ -0,0 +1,13 @@ +import { ASTVisitor } from '../../language/visitor'; +import { ASTValidationContext } from '../ValidationContext'; + +export function duplicateDirectiveNameMessage(directiveName: string): string; + +export function existedDirectiveNameMessage(directiveName: string): string; + +/** + * Unique directive names + * + * A GraphQL document is only valid if all defined directives have unique names. + */ +export function UniqueDirectiveNames(context: SDLValidationContext): ASTVisitor; diff --git a/tstypes/validation/rules/UniqueDirectivesPerLocation.d.ts b/tstypes/validation/rules/UniqueDirectivesPerLocation.d.ts index 879eea7eeb..02c73123cd 100644 --- a/tstypes/validation/rules/UniqueDirectivesPerLocation.d.ts +++ b/tstypes/validation/rules/UniqueDirectivesPerLocation.d.ts @@ -1,5 +1,5 @@ -import { ASTValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ASTValidationContext } from '../ValidationContext'; export function duplicateDirectiveMessage(directiveName: string): string; diff --git a/tstypes/validation/rules/UniqueEnumValueNames.d.ts b/tstypes/validation/rules/UniqueEnumValueNames.d.ts new file mode 100644 index 0000000000..2f3f654092 --- /dev/null +++ b/tstypes/validation/rules/UniqueEnumValueNames.d.ts @@ -0,0 +1,19 @@ +import { ASTVisitor } from '../../language/visitor'; +import { SDLValidationContext } from '../ValidationContext'; + +export function duplicateEnumValueNameMessage( + typeName: string, + valueName: string, +): string; + +export function existedEnumValueNameMessage( + typeName: string, + valueName: string, +): string; + +/** + * Unique enum value names + * + * A GraphQL enum type is only valid if all its values are uniquely named. + */ +export function UniqueEnumValueNames(context: SDLValidationContext): ASTVisitor; diff --git a/tstypes/validation/rules/UniqueFieldDefinitionNames.d.ts b/tstypes/validation/rules/UniqueFieldDefinitionNames.d.ts new file mode 100644 index 0000000000..11d6e4fb64 --- /dev/null +++ b/tstypes/validation/rules/UniqueFieldDefinitionNames.d.ts @@ -0,0 +1,21 @@ +import { ASTVisitor } from '../../language/visitor'; +import { SDLValidationContext } from '../ValidationContext'; + +export function duplicateFieldDefinitionNameMessage( + typeName: string, + fieldName: string, +): string; + +export function existedFieldDefinitionNameMessage( + typeName: string, + fieldName: string, +): string; + +/** + * Unique field definition names + * + * A GraphQL complex type is only valid if all its fields are uniquely named. + */ +export function UniqueFieldDefinitionNames( + context: SDLValidationContext, +): ASTVisitor; diff --git a/tstypes/validation/rules/UniqueFragmentNames.d.ts b/tstypes/validation/rules/UniqueFragmentNames.d.ts index e849d9fe32..ebd4bb2d6e 100644 --- a/tstypes/validation/rules/UniqueFragmentNames.d.ts +++ b/tstypes/validation/rules/UniqueFragmentNames.d.ts @@ -1,5 +1,5 @@ -import { ASTValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ASTValidationContext } from '../ValidationContext'; export function duplicateFragmentNameMessage(fragName: string): string; diff --git a/tstypes/validation/rules/UniqueInputFieldNames.d.ts b/tstypes/validation/rules/UniqueInputFieldNames.d.ts index d2682fec0b..3894428ca8 100644 --- a/tstypes/validation/rules/UniqueInputFieldNames.d.ts +++ b/tstypes/validation/rules/UniqueInputFieldNames.d.ts @@ -1,5 +1,5 @@ -import { ASTValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ASTValidationContext } from '../ValidationContext'; export function duplicateInputFieldMessage(fieldName: string): string; diff --git a/tstypes/validation/rules/UniqueOperationNames.d.ts b/tstypes/validation/rules/UniqueOperationNames.d.ts index bd31be1ee2..0c6234965a 100644 --- a/tstypes/validation/rules/UniqueOperationNames.d.ts +++ b/tstypes/validation/rules/UniqueOperationNames.d.ts @@ -1,5 +1,5 @@ -import { ASTValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ASTValidationContext } from '../ValidationContext'; export function duplicateOperationNameMessage(operationName: string): string; diff --git a/tstypes/validation/rules/UniqueOperationTypes.d.ts b/tstypes/validation/rules/UniqueOperationTypes.d.ts new file mode 100644 index 0000000000..fef615bbc1 --- /dev/null +++ b/tstypes/validation/rules/UniqueOperationTypes.d.ts @@ -0,0 +1,13 @@ +import { ASTVisitor } from '../../language/visitor'; +import { SDLValidationContext } from '../ValidationContext'; + +export function duplicateOperationTypeMessage(operation: string): string; + +export function existedOperationTypeMessage(operation: string): string; + +/** + * Unique operation types + * + * A GraphQL document is only valid if it has only one type per operation. + */ +export function UniqueOperationTypes(context: SDLValidationContext): ASTVisitor; diff --git a/tstypes/validation/rules/UniqueTypeNames.d.ts b/tstypes/validation/rules/UniqueTypeNames.d.ts new file mode 100644 index 0000000000..8b9e3ad3ab --- /dev/null +++ b/tstypes/validation/rules/UniqueTypeNames.d.ts @@ -0,0 +1,13 @@ +import { ASTVisitor } from '../../language/visitor'; +import { SDLValidationContext } from '../ValidationContext'; + +export function duplicateTypeNameMessage(typeName: string): string; + +export function existedTypeNameMessage(typeName: string): string; + +/** + * Unique type names + * + * A GraphQL document is only valid if all defined types have unique names. + */ +export function UniqueTypeNames(context: SDLValidationContext): ASTVisitor; diff --git a/tstypes/validation/rules/UniqueVariableNames.d.ts b/tstypes/validation/rules/UniqueVariableNames.d.ts index ac81c95f9e..0ed9633804 100644 --- a/tstypes/validation/rules/UniqueVariableNames.d.ts +++ b/tstypes/validation/rules/UniqueVariableNames.d.ts @@ -1,5 +1,5 @@ -import { ASTValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ASTValidationContext } from '../ValidationContext'; export function duplicateVariableMessage(variableName: string): string; diff --git a/tstypes/validation/rules/ValuesOfCorrectType.d.ts b/tstypes/validation/rules/ValuesOfCorrectType.d.ts index 3ef5d6d4ed..9b475cf272 100644 --- a/tstypes/validation/rules/ValuesOfCorrectType.d.ts +++ b/tstypes/validation/rules/ValuesOfCorrectType.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function badValueMessage( typeName: string, @@ -7,6 +7,12 @@ export function badValueMessage( message?: string, ): string; +export function badEnumValueMessage( + typeName: string, + valueName: string, + suggestedValues: ReadonlyArray, +): string; + export function requiredFieldMessage( typeName: string, fieldName: string, @@ -16,7 +22,7 @@ export function requiredFieldMessage( export function unknownFieldMessage( typeName: string, fieldName: string, - message?: string, + suggestedFields: ReadonlyArray, ): string; /** diff --git a/tstypes/validation/rules/VariablesAreInputTypes.d.ts b/tstypes/validation/rules/VariablesAreInputTypes.d.ts index f5103aea20..ace6fea4b5 100644 --- a/tstypes/validation/rules/VariablesAreInputTypes.d.ts +++ b/tstypes/validation/rules/VariablesAreInputTypes.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function nonInputTypeOnVarMessage( variableName: string, diff --git a/tstypes/validation/rules/VariablesInAllowedPosition.d.ts b/tstypes/validation/rules/VariablesInAllowedPosition.d.ts index 84a5dade51..3401c9767f 100644 --- a/tstypes/validation/rules/VariablesInAllowedPosition.d.ts +++ b/tstypes/validation/rules/VariablesInAllowedPosition.d.ts @@ -1,5 +1,5 @@ -import { ValidationContext } from '../ValidationContext'; import { ASTVisitor } from '../../language/visitor'; +import { ValidationContext } from '../ValidationContext'; export function badVarPosMessage( varName: string, diff --git a/tstypes/validation/specifiedRules.d.ts b/tstypes/validation/specifiedRules.d.ts index 98e9e5eb2b..e26fae8980 100644 --- a/tstypes/validation/specifiedRules.d.ts +++ b/tstypes/validation/specifiedRules.d.ts @@ -58,7 +58,10 @@ import { KnownDirectives } from './rules/KnownDirectives'; import { UniqueDirectivesPerLocation } from './rules/UniqueDirectivesPerLocation'; // Spec Section: "Argument Names" -import { KnownArgumentNames } from './rules/KnownArgumentNames'; +import { + KnownArgumentNames, + KnownArgumentNamesOnDirectives, // @internal +} from './rules/KnownArgumentNames'; // Spec Section: "Argument Uniqueness" import { UniqueArgumentNames } from './rules/UniqueArgumentNames'; @@ -67,7 +70,10 @@ import { UniqueArgumentNames } from './rules/UniqueArgumentNames'; import { ValuesOfCorrectType } from './rules/ValuesOfCorrectType'; // Spec Section: "Argument Optionality" -import { ProvidedRequiredArguments } from './rules/ProvidedRequiredArguments'; +import { + ProvidedRequiredArguments, + ProvidedRequiredArgumentsOnDirectives, // @internal +} from './rules/ProvidedRequiredArguments'; // Spec Section: "All Variable Usages Are Allowed" import { VariablesInAllowedPosition } from './rules/VariablesInAllowedPosition'; diff --git a/tstypes/validation/validate.d.ts b/tstypes/validation/validate.d.ts index 9fe20452a9..e1b80ad3cb 100644 --- a/tstypes/validation/validate.d.ts +++ b/tstypes/validation/validate.d.ts @@ -3,6 +3,7 @@ import { DocumentNode } from '../language/ast'; import { GraphQLSchema } from '../type/schema'; import { TypeInfo } from '../utilities/TypeInfo'; import { ValidationRule, SDLValidationRule } from './ValidationContext'; +import Maybe from 'tstypes/tsutils/Maybe'; /** * Implements the "Validation" section of the spec. @@ -25,12 +26,13 @@ export function validate( documentAST: DocumentNode, rules?: ReadonlyArray, typeInfo?: TypeInfo, + options?: { maxErrors?: number }, ): ReadonlyArray; // @internal export function validateSDL( documentAST: DocumentNode, - schemaToExtend?: GraphQLSchema | null, + schemaToExtend?: Maybe, rules?: ReadonlyArray, ): GraphQLError[];