graphql 14.4.2 → 14.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -10
- package/error/GraphQLError.d.ts +87 -0
- package/error/GraphQLError.js +7 -45
- package/error/GraphQLError.js.flow +1 -0
- package/error/GraphQLError.mjs +7 -45
- package/error/formatError.d.ts +39 -0
- package/error/formatError.js +5 -2
- package/error/formatError.js.flow +27 -3
- package/error/formatError.mjs +5 -2
- package/error/index.d.ts +4 -0
- package/error/locatedError.d.ts +13 -0
- package/error/locatedError.js.flow +2 -1
- package/error/locatedError.mjs +1 -1
- package/error/syntaxError.d.ts +12 -0
- package/error/syntaxError.js.flow +1 -0
- package/execution/execute.d.ts +190 -0
- package/execution/execute.js +55 -89
- package/execution/execute.js.flow +95 -133
- package/execution/execute.mjs +75 -80
- package/execution/index.d.ts +11 -0
- package/execution/index.js +8 -6
- package/execution/index.js.flow +3 -6
- package/execution/index.mjs +2 -1
- package/execution/values.d.ts +68 -0
- package/execution/values.js +119 -128
- package/execution/values.js.flow +150 -127
- package/execution/values.mjs +117 -125
- package/graphql.d.ts +88 -0
- package/graphql.js +5 -5
- package/graphql.js.flow +9 -5
- package/graphql.mjs +41 -1
- package/index.d.ts +446 -0
- package/index.js +6 -0
- package/index.js.flow +3 -1
- package/index.mjs +2 -1
- package/jsutils/ObjMap.js.flow +6 -0
- package/jsutils/Path.d.ts +14 -0
- package/jsutils/Path.js +33 -0
- package/jsutils/Path.js.flow +26 -0
- package/jsutils/Path.mjs +24 -0
- package/jsutils/PromiseOrValue.d.ts +1 -0
- package/jsutils/dedent.js +6 -24
- package/jsutils/dedent.mjs +6 -24
- package/jsutils/defineToStringTag.js.flow +1 -1
- package/jsutils/devAssert.js +14 -0
- package/jsutils/devAssert.js.flow +8 -0
- package/jsutils/devAssert.mjs +7 -0
- package/jsutils/inspect.js +1 -1
- package/jsutils/inspect.js.flow +1 -1
- package/jsutils/inspect.mjs +1 -1
- package/jsutils/invariant.js +1 -2
- package/jsutils/invariant.js.flow +2 -3
- package/jsutils/invariant.mjs +1 -2
- package/jsutils/mapValue.js +6 -24
- package/jsutils/mapValue.js.flow +2 -1
- package/jsutils/mapValue.mjs +6 -24
- package/jsutils/printPathArray.js +15 -0
- package/jsutils/printPathArray.js.flow +14 -0
- package/jsutils/printPathArray.mjs +8 -0
- package/jsutils/suggestionList.js +14 -34
- package/jsutils/suggestionList.js.flow +4 -6
- package/jsutils/suggestionList.mjs +14 -34
- package/jsutils/toObjMap.js +28 -0
- package/jsutils/toObjMap.js.flow +26 -0
- package/jsutils/toObjMap.mjs +18 -0
- package/language/ast.d.ts +573 -0
- package/language/blockString.d.ts +21 -0
- package/language/directiveLocation.d.ts +35 -0
- package/language/index.d.ts +96 -0
- package/language/kinds.d.ts +77 -0
- package/language/lexer.d.ts +60 -0
- package/language/lexer.js +2 -12
- package/language/lexer.js.flow +6 -12
- package/language/lexer.mjs +1 -9
- package/language/location.d.ts +15 -0
- package/language/parser.d.ts +89 -0
- package/language/parser.js +1329 -1302
- package/language/parser.js.flow +1289 -1298
- package/language/parser.mjs +1326 -1297
- package/language/predicates.d.ts +36 -0
- package/language/predicates.js.flow +1 -1
- package/language/printLocation.d.ts +16 -0
- package/language/printLocation.js.flow +1 -1
- package/language/printer.d.ts +7 -0
- package/language/printer.js.flow +1 -1
- package/language/source.d.ts +19 -0
- package/language/source.js +3 -3
- package/language/source.js.flow +3 -3
- package/language/source.mjs +3 -3
- package/language/tokenKind.d.ts +35 -0
- package/language/visitor.d.ts +264 -0
- package/language/visitor.js +2 -2
- package/language/visitor.js.flow +3 -1
- package/language/visitor.mjs +2 -2
- package/package.json +1 -1
- package/polyfills/find.js +2 -2
- package/polyfills/find.js.flow +1 -2
- package/polyfills/find.mjs +2 -2
- package/polyfills/flatMap.js +3 -3
- package/polyfills/flatMap.js.flow +2 -3
- package/polyfills/flatMap.mjs +3 -3
- package/subscription/asyncIteratorReject.d.ts +6 -0
- package/subscription/index.d.ts +5 -0
- package/subscription/mapAsyncIterator.d.ts +9 -0
- package/subscription/mapAsyncIterator.js.flow +1 -0
- package/subscription/subscribe.d.ts +86 -0
- package/subscription/subscribe.js +29 -10
- package/subscription/subscribe.js.flow +45 -24
- package/subscription/subscribe.mjs +27 -9
- package/tsutils/Maybe.d.ts +4 -0
- package/type/definition.d.ts +805 -0
- package/type/definition.js +154 -70
- package/type/definition.js.flow +217 -160
- package/type/definition.mjs +149 -66
- package/type/directives.d.ts +72 -0
- package/type/directives.js +20 -12
- package/type/directives.js.flow +34 -19
- package/type/directives.mjs +17 -10
- package/type/index.d.ts +155 -0
- package/type/index.js.flow +2 -2
- package/type/introspection.d.ts +40 -0
- package/type/introspection.js +24 -10
- package/type/introspection.js.flow +29 -8
- package/type/introspection.mjs +23 -10
- package/type/scalars.d.ts +11 -0
- package/type/scalars.js +2 -2
- package/type/scalars.js.flow +4 -1
- package/type/scalars.mjs +2 -2
- package/type/schema.d.ts +108 -0
- package/type/schema.js +74 -151
- package/type/schema.js.flow +75 -73
- package/type/schema.mjs +75 -149
- package/type/validate.d.ts +19 -0
- package/type/validate.js +227 -486
- package/type/validate.js.flow +13 -8
- package/type/validate.mjs +218 -477
- package/utilities/TypeInfo.d.ts +49 -0
- package/utilities/TypeInfo.js.flow +9 -6
- package/utilities/assertValidName.d.ts +15 -0
- package/utilities/assertValidName.js +3 -3
- package/utilities/assertValidName.js.flow +3 -2
- package/utilities/assertValidName.mjs +2 -2
- package/utilities/astFromValue.d.ts +25 -0
- package/utilities/astFromValue.js +22 -38
- package/utilities/astFromValue.js.flow +7 -4
- package/utilities/astFromValue.mjs +19 -36
- package/utilities/buildASTSchema.d.ts +114 -0
- package/utilities/buildASTSchema.js +37 -68
- package/utilities/buildASTSchema.js.flow +32 -30
- package/utilities/buildASTSchema.mjs +32 -64
- package/utilities/buildClientSchema.d.ts +21 -0
- package/utilities/buildClientSchema.js +23 -15
- package/utilities/buildClientSchema.js.flow +17 -16
- package/utilities/buildClientSchema.mjs +20 -12
- package/utilities/coerceInputValue.d.ts +17 -0
- package/utilities/coerceInputValue.js +161 -0
- package/utilities/coerceInputValue.js.flow +214 -0
- package/utilities/coerceInputValue.mjs +142 -0
- package/utilities/coerceValue.d.ts +23 -0
- package/utilities/coerceValue.js +21 -199
- package/utilities/coerceValue.js.flow +31 -223
- package/utilities/coerceValue.mjs +20 -195
- package/utilities/concatAST.d.ts +8 -0
- package/utilities/concatAST.js.flow +1 -0
- package/utilities/extendSchema.d.ts +45 -0
- package/utilities/extendSchema.js +64 -131
- package/utilities/extendSchema.js.flow +27 -24
- package/utilities/extendSchema.mjs +61 -129
- package/utilities/findBreakingChanges.d.ts +64 -0
- package/utilities/findBreakingChanges.js +194 -619
- package/utilities/findBreakingChanges.js.flow +8 -5
- package/utilities/findBreakingChanges.mjs +194 -619
- package/utilities/findDeprecatedUsages.d.ts +13 -0
- package/utilities/findDeprecatedUsages.js.flow +4 -1
- package/utilities/getOperationAST.d.ts +12 -0
- package/utilities/getOperationAST.js +13 -31
- package/utilities/getOperationAST.mjs +13 -31
- package/utilities/getOperationRootType.d.ts +14 -0
- package/utilities/getOperationRootType.js.flow +2 -0
- package/utilities/index.d.ts +127 -0
- package/utilities/index.js +8 -0
- package/utilities/index.js.flow +4 -1
- package/utilities/index.mjs +3 -1
- package/utilities/introspectionFromSchema.d.ts +16 -0
- package/utilities/introspectionFromSchema.js +5 -3
- package/utilities/introspectionFromSchema.js.flow +4 -2
- package/utilities/introspectionFromSchema.mjs +4 -2
- package/utilities/introspectionQuery.d.ts +177 -0
- package/utilities/isValidJSValue.d.ts +8 -0
- package/utilities/isValidJSValue.js +1 -1
- package/utilities/isValidJSValue.js.flow +3 -2
- package/utilities/isValidJSValue.mjs +2 -2
- package/utilities/isValidLiteralValue.d.ts +15 -0
- package/utilities/isValidLiteralValue.js +4 -4
- package/utilities/isValidLiteralValue.js.flow +8 -4
- package/utilities/isValidLiteralValue.mjs +2 -2
- package/utilities/lexicographicSortSchema.d.ts +6 -0
- package/utilities/lexicographicSortSchema.js +11 -8
- package/utilities/lexicographicSortSchema.js.flow +5 -3
- package/utilities/lexicographicSortSchema.mjs +9 -7
- package/utilities/schemaPrinter.d.ts +30 -0
- package/utilities/schemaPrinter.js +15 -32
- package/utilities/schemaPrinter.js.flow +14 -10
- package/utilities/schemaPrinter.mjs +14 -32
- package/utilities/separateOperations.d.ts +11 -0
- package/utilities/separateOperations.js +6 -6
- package/utilities/separateOperations.js.flow +2 -1
- package/utilities/separateOperations.mjs +6 -6
- package/utilities/stripIgnoredCharacters.d.ts +55 -0
- package/utilities/stripIgnoredCharacters.js.flow +1 -0
- package/utilities/typeComparators.d.ts +32 -0
- package/utilities/typeComparators.js.flow +1 -1
- package/utilities/typeComparators.mjs +1 -1
- package/utilities/typeFromAST.d.ts +29 -0
- package/utilities/typeFromAST.js +5 -3
- package/utilities/typeFromAST.js.flow +5 -3
- package/utilities/typeFromAST.mjs +14 -3
- package/utilities/valueFromAST.d.ts +29 -0
- package/utilities/valueFromAST.js +40 -74
- package/utilities/valueFromAST.js.flow +7 -4
- package/utilities/valueFromAST.mjs +39 -74
- package/utilities/valueFromASTUntyped.d.ts +23 -0
- package/utilities/valueFromASTUntyped.js +4 -3
- package/utilities/valueFromASTUntyped.js.flow +3 -2
- package/utilities/valueFromASTUntyped.mjs +3 -3
- package/validation/ValidationContext.d.ts +96 -0
- package/validation/ValidationContext.js +38 -86
- package/validation/ValidationContext.js.flow +22 -7
- package/validation/ValidationContext.mjs +37 -85
- package/validation/index.d.ts +126 -0
- package/validation/rules/ExecutableDefinitions.d.ts +14 -0
- package/validation/rules/ExecutableDefinitions.js +4 -23
- package/validation/rules/ExecutableDefinitions.js.flow +4 -2
- package/validation/rules/ExecutableDefinitions.mjs +4 -23
- package/validation/rules/FieldsOnCorrectType.d.ts +17 -0
- package/validation/rules/FieldsOnCorrectType.js +21 -57
- package/validation/rules/FieldsOnCorrectType.js.flow +7 -3
- package/validation/rules/FieldsOnCorrectType.mjs +21 -57
- package/validation/rules/FragmentsOnCompositeTypes.d.ts +20 -0
- package/validation/rules/FragmentsOnCompositeTypes.js.flow +5 -1
- package/validation/rules/KnownArgumentNames.d.ts +28 -0
- package/validation/rules/KnownArgumentNames.js +26 -79
- package/validation/rules/KnownArgumentNames.js.flow +10 -6
- package/validation/rules/KnownArgumentNames.mjs +22 -75
- package/validation/rules/KnownDirectives.d.ts +19 -0
- package/validation/rules/KnownDirectives.js +12 -48
- package/validation/rules/KnownDirectives.js.flow +8 -5
- package/validation/rules/KnownDirectives.mjs +12 -48
- package/validation/rules/KnownFragmentNames.d.ts +12 -0
- package/validation/rules/KnownFragmentNames.js.flow +2 -1
- package/validation/rules/KnownTypeNames.d.ts +15 -0
- package/validation/rules/KnownTypeNames.js +6 -24
- package/validation/rules/KnownTypeNames.js.flow +10 -6
- package/validation/rules/KnownTypeNames.mjs +6 -24
- package/validation/rules/LoneAnonymousOperation.d.ts +14 -0
- package/validation/rules/LoneAnonymousOperation.js.flow +3 -1
- package/validation/rules/LoneSchemaDefinition.d.ts +13 -0
- package/validation/rules/LoneSchemaDefinition.js.flow +2 -1
- package/validation/rules/NoFragmentCycles.d.ts +9 -0
- package/validation/rules/NoFragmentCycles.js +17 -35
- package/validation/rules/NoFragmentCycles.js.flow +4 -2
- package/validation/rules/NoFragmentCycles.mjs +17 -35
- package/validation/rules/NoUndefinedVariables.d.ts +16 -0
- package/validation/rules/NoUndefinedVariables.js +6 -24
- package/validation/rules/NoUndefinedVariables.js.flow +2 -1
- package/validation/rules/NoUndefinedVariables.mjs +6 -24
- package/validation/rules/NoUnusedFragments.d.ts +12 -0
- package/validation/rules/NoUnusedFragments.js +7 -25
- package/validation/rules/NoUnusedFragments.js.flow +2 -1
- package/validation/rules/NoUnusedFragments.mjs +7 -25
- package/validation/rules/NoUnusedVariables.d.ts +16 -0
- package/validation/rules/NoUnusedVariables.js +6 -24
- package/validation/rules/NoUnusedVariables.js.flow +2 -1
- package/validation/rules/NoUnusedVariables.mjs +6 -24
- package/validation/rules/OverlappingFieldsCanBeMerged.d.ts +24 -0
- package/validation/rules/OverlappingFieldsCanBeMerged.js +27 -46
- package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +17 -8
- package/validation/rules/OverlappingFieldsCanBeMerged.mjs +25 -44
- package/validation/rules/PossibleFragmentSpreads.d.ts +22 -0
- package/validation/rules/PossibleFragmentSpreads.js +2 -2
- package/validation/rules/PossibleFragmentSpreads.js.flow +8 -3
- package/validation/rules/PossibleFragmentSpreads.mjs +2 -2
- package/validation/rules/PossibleTypeExtensions.d.ts +21 -0
- package/validation/rules/PossibleTypeExtensions.js +4 -22
- package/validation/rules/PossibleTypeExtensions.js.flow +6 -2
- package/validation/rules/PossibleTypeExtensions.mjs +4 -22
- package/validation/rules/ProvidedRequiredArguments.d.ts +29 -0
- package/validation/rules/ProvidedRequiredArguments.js +27 -79
- package/validation/rules/ProvidedRequiredArguments.js.flow +12 -8
- package/validation/rules/ProvidedRequiredArguments.mjs +25 -77
- package/validation/rules/ScalarLeafs.d.ts +20 -0
- package/validation/rules/ScalarLeafs.js.flow +6 -2
- package/validation/rules/SingleFieldSubscriptions.d.ts +14 -0
- package/validation/rules/SingleFieldSubscriptions.js.flow +4 -2
- package/validation/rules/UniqueArgumentNames.d.ts +12 -0
- package/validation/rules/UniqueArgumentNames.js.flow +2 -1
- package/validation/rules/UniqueDirectiveNames.d.ts +13 -0
- package/validation/rules/UniqueDirectiveNames.js.flow +2 -1
- package/validation/rules/UniqueDirectivesPerLocation.d.ts +14 -0
- package/validation/rules/UniqueDirectivesPerLocation.js +15 -69
- package/validation/rules/UniqueDirectivesPerLocation.js.flow +7 -4
- package/validation/rules/UniqueDirectivesPerLocation.mjs +15 -69
- package/validation/rules/UniqueEnumValueNames.d.ts +19 -0
- package/validation/rules/UniqueEnumValueNames.js +10 -28
- package/validation/rules/UniqueEnumValueNames.js.flow +2 -1
- package/validation/rules/UniqueEnumValueNames.mjs +10 -28
- package/validation/rules/UniqueFieldDefinitionNames.d.ts +21 -0
- package/validation/rules/UniqueFieldDefinitionNames.js +9 -27
- package/validation/rules/UniqueFieldDefinitionNames.js.flow +2 -1
- package/validation/rules/UniqueFieldDefinitionNames.mjs +9 -27
- package/validation/rules/UniqueFragmentNames.d.ts +11 -0
- package/validation/rules/UniqueFragmentNames.js.flow +2 -1
- package/validation/rules/UniqueInputFieldNames.d.ts +14 -0
- package/validation/rules/UniqueInputFieldNames.js.flow +2 -1
- package/validation/rules/UniqueOperationNames.d.ts +11 -0
- package/validation/rules/UniqueOperationNames.js.flow +2 -1
- package/validation/rules/UniqueOperationTypes.d.ts +13 -0
- package/validation/rules/UniqueOperationTypes.js +11 -30
- package/validation/rules/UniqueOperationTypes.js.flow +2 -1
- package/validation/rules/UniqueOperationTypes.mjs +10 -29
- package/validation/rules/UniqueTypeNames.d.ts +13 -0
- package/validation/rules/UniqueTypeNames.js.flow +3 -1
- package/validation/rules/UniqueVariableNames.d.ts +11 -0
- package/validation/rules/UniqueVariableNames.js.flow +4 -2
- package/validation/rules/ValuesOfCorrectType.d.ts +34 -0
- package/validation/rules/ValuesOfCorrectType.js +16 -34
- package/validation/rules/ValuesOfCorrectType.js.flow +11 -6
- package/validation/rules/ValuesOfCorrectType.mjs +12 -30
- package/validation/rules/VariablesAreInputTypes.d.ts +15 -0
- package/validation/rules/VariablesAreInputTypes.js.flow +6 -2
- package/validation/rules/VariablesInAllowedPosition.d.ts +15 -0
- package/validation/rules/VariablesInAllowedPosition.js +22 -40
- package/validation/rules/VariablesInAllowedPosition.js.flow +8 -3
- package/validation/rules/VariablesInAllowedPosition.mjs +18 -36
- package/validation/specifiedRules.d.ts +98 -0
- package/validation/validate.d.ts +56 -0
- package/validation/validate.js +35 -7
- package/validation/validate.js.flow +51 -9
- package/validation/validate.mjs +30 -7
- package/version.d.ts +14 -0
- package/version.js +3 -3
- package/version.js.flow +3 -3
- package/version.mjs +3 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ASTVisitor } from '../../language/visitor';
|
|
2
|
+
import { ASTValidationContext } from '../ValidationContext';
|
|
3
|
+
|
|
4
|
+
export function nonExecutableDefinitionMessage(defName: string): string;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Executable definitions
|
|
8
|
+
*
|
|
9
|
+
* A GraphQL document is only valid for execution if all definitions are either
|
|
10
|
+
* operation or fragment definitions.
|
|
11
|
+
*/
|
|
12
|
+
export function ExecutableDefinitions(
|
|
13
|
+
context: ASTValidationContext,
|
|
14
|
+
): ASTVisitor;
|
|
@@ -26,30 +26,11 @@ function nonExecutableDefinitionMessage(defName) {
|
|
|
26
26
|
function ExecutableDefinitions(context) {
|
|
27
27
|
return {
|
|
28
28
|
Document: function Document(node) {
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
var _iteratorError = undefined;
|
|
29
|
+
for (var _i2 = 0, _node$definitions2 = node.definitions; _i2 < _node$definitions2.length; _i2++) {
|
|
30
|
+
var definition = _node$definitions2[_i2];
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var definition = _step.value;
|
|
36
|
-
|
|
37
|
-
if (!(0, _predicates.isExecutableDefinitionNode)(definition)) {
|
|
38
|
-
context.reportError(new _GraphQLError.GraphQLError(nonExecutableDefinitionMessage(definition.kind === _kinds.Kind.SCHEMA_DEFINITION || definition.kind === _kinds.Kind.SCHEMA_EXTENSION ? 'schema' : definition.name.value), definition));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
} catch (err) {
|
|
42
|
-
_didIteratorError = true;
|
|
43
|
-
_iteratorError = err;
|
|
44
|
-
} finally {
|
|
45
|
-
try {
|
|
46
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
47
|
-
_iterator.return();
|
|
48
|
-
}
|
|
49
|
-
} finally {
|
|
50
|
-
if (_didIteratorError) {
|
|
51
|
-
throw _iteratorError;
|
|
52
|
-
}
|
|
32
|
+
if (!(0, _predicates.isExecutableDefinitionNode)(definition)) {
|
|
33
|
+
context.reportError(new _GraphQLError.GraphQLError(nonExecutableDefinitionMessage(definition.kind === _kinds.Kind.SCHEMA_DEFINITION || definition.kind === _kinds.Kind.SCHEMA_EXTENSION ? 'schema' : definition.name.value), definition));
|
|
53
34
|
}
|
|
54
35
|
}
|
|
55
36
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
|
|
3
|
-
import { type ASTValidationContext } from '../ValidationContext';
|
|
4
3
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
4
|
+
|
|
5
5
|
import { Kind } from '../../language/kinds';
|
|
6
|
-
import { isExecutableDefinitionNode } from '../../language/predicates';
|
|
7
6
|
import { type ASTVisitor } from '../../language/visitor';
|
|
7
|
+
import { isExecutableDefinitionNode } from '../../language/predicates';
|
|
8
|
+
|
|
9
|
+
import { type ASTValidationContext } from '../ValidationContext';
|
|
8
10
|
|
|
9
11
|
export function nonExecutableDefinitionMessage(defName: string): string {
|
|
10
12
|
return `The ${defName} definition is not executable.`;
|
|
@@ -14,30 +14,11 @@ export function nonExecutableDefinitionMessage(defName) {
|
|
|
14
14
|
export function ExecutableDefinitions(context) {
|
|
15
15
|
return {
|
|
16
16
|
Document: function Document(node) {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
var _iteratorError = undefined;
|
|
17
|
+
for (var _i2 = 0, _node$definitions2 = node.definitions; _i2 < _node$definitions2.length; _i2++) {
|
|
18
|
+
var definition = _node$definitions2[_i2];
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var definition = _step.value;
|
|
24
|
-
|
|
25
|
-
if (!isExecutableDefinitionNode(definition)) {
|
|
26
|
-
context.reportError(new GraphQLError(nonExecutableDefinitionMessage(definition.kind === Kind.SCHEMA_DEFINITION || definition.kind === Kind.SCHEMA_EXTENSION ? 'schema' : definition.name.value), definition));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
} catch (err) {
|
|
30
|
-
_didIteratorError = true;
|
|
31
|
-
_iteratorError = err;
|
|
32
|
-
} finally {
|
|
33
|
-
try {
|
|
34
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
35
|
-
_iterator.return();
|
|
36
|
-
}
|
|
37
|
-
} finally {
|
|
38
|
-
if (_didIteratorError) {
|
|
39
|
-
throw _iteratorError;
|
|
40
|
-
}
|
|
20
|
+
if (!isExecutableDefinitionNode(definition)) {
|
|
21
|
+
context.reportError(new GraphQLError(nonExecutableDefinitionMessage(definition.kind === Kind.SCHEMA_DEFINITION || definition.kind === Kind.SCHEMA_EXTENSION ? 'schema' : definition.name.value), definition));
|
|
41
22
|
}
|
|
42
23
|
}
|
|
43
24
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ASTVisitor } from '../../language/visitor';
|
|
2
|
+
import { ValidationContext } from '../ValidationContext';
|
|
3
|
+
|
|
4
|
+
export function undefinedFieldMessage(
|
|
5
|
+
fieldName: string,
|
|
6
|
+
type: string,
|
|
7
|
+
suggestedTypeNames: ReadonlyArray<string>,
|
|
8
|
+
suggestedFieldNames: ReadonlyArray<string>,
|
|
9
|
+
): string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Fields on correct type
|
|
13
|
+
*
|
|
14
|
+
* A GraphQL document is only valid if all fields selected are defined by the
|
|
15
|
+
* parent type, or are an allowed meta field such as __typename.
|
|
16
|
+
*/
|
|
17
|
+
export function FieldsOnCorrectType(context: ValidationContext): ASTVisitor;
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.undefinedFieldMessage = undefinedFieldMessage;
|
|
7
7
|
exports.FieldsOnCorrectType = FieldsOnCorrectType;
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean"));
|
|
10
10
|
|
|
11
11
|
var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList"));
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _GraphQLError = require("../../error/GraphQLError");
|
|
14
14
|
|
|
15
15
|
var _definition = require("../../type/definition");
|
|
16
16
|
|
|
@@ -67,65 +67,29 @@ function getSuggestedTypeNames(schema, type, fieldName) {
|
|
|
67
67
|
if ((0, _definition.isAbstractType)(type)) {
|
|
68
68
|
var suggestedObjectTypes = [];
|
|
69
69
|
var interfaceUsageCount = Object.create(null);
|
|
70
|
-
var _iteratorNormalCompletion = true;
|
|
71
|
-
var _didIteratorError = false;
|
|
72
|
-
var _iteratorError = undefined;
|
|
73
70
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {
|
|
72
|
+
var possibleType = _schema$getPossibleTy2[_i2];
|
|
73
|
+
|
|
74
|
+
if (!possibleType.getFields()[fieldName]) {
|
|
75
|
+
continue;
|
|
76
|
+
} // This object type defines this field.
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
suggestedObjectTypes.push(possibleType.name);
|
|
80
|
+
|
|
81
|
+
for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {
|
|
82
|
+
var possibleInterface = _possibleType$getInte2[_i4];
|
|
77
83
|
|
|
78
|
-
if (!
|
|
84
|
+
if (!possibleInterface.getFields()[fieldName]) {
|
|
79
85
|
continue;
|
|
80
|
-
} // This
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var _iteratorNormalCompletion2 = true;
|
|
85
|
-
var _didIteratorError2 = false;
|
|
86
|
-
var _iteratorError2 = undefined;
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
for (var _iterator2 = possibleType.getInterfaces()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
90
|
-
var possibleInterface = _step2.value;
|
|
91
|
-
|
|
92
|
-
if (!possibleInterface.getFields()[fieldName]) {
|
|
93
|
-
continue;
|
|
94
|
-
} // This interface type defines this field.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
interfaceUsageCount[possibleInterface.name] = (interfaceUsageCount[possibleInterface.name] || 0) + 1;
|
|
98
|
-
}
|
|
99
|
-
} catch (err) {
|
|
100
|
-
_didIteratorError2 = true;
|
|
101
|
-
_iteratorError2 = err;
|
|
102
|
-
} finally {
|
|
103
|
-
try {
|
|
104
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
105
|
-
_iterator2.return();
|
|
106
|
-
}
|
|
107
|
-
} finally {
|
|
108
|
-
if (_didIteratorError2) {
|
|
109
|
-
throw _iteratorError2;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
} // Suggest interface types based on how common they are.
|
|
114
|
-
|
|
115
|
-
} catch (err) {
|
|
116
|
-
_didIteratorError = true;
|
|
117
|
-
_iteratorError = err;
|
|
118
|
-
} finally {
|
|
119
|
-
try {
|
|
120
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
121
|
-
_iterator.return();
|
|
122
|
-
}
|
|
123
|
-
} finally {
|
|
124
|
-
if (_didIteratorError) {
|
|
125
|
-
throw _iteratorError;
|
|
126
|
-
}
|
|
86
|
+
} // This interface type defines this field.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
interfaceUsageCount[possibleInterface.name] = (interfaceUsageCount[possibleInterface.name] || 0) + 1;
|
|
127
90
|
}
|
|
128
|
-
}
|
|
91
|
+
} // Suggest interface types based on how common they are.
|
|
92
|
+
|
|
129
93
|
|
|
130
94
|
var suggestedInterfaceTypes = Object.keys(interfaceUsageCount).sort(function (a, b) {
|
|
131
95
|
return interfaceUsageCount[b] - interfaceUsageCount[a];
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
|
|
3
|
-
import { type ValidationContext } from '../ValidationContext';
|
|
4
|
-
import { GraphQLError } from '../../error/GraphQLError';
|
|
5
|
-
import suggestionList from '../../jsutils/suggestionList';
|
|
6
3
|
import didYouMean from '../../jsutils/didYouMean';
|
|
4
|
+
import suggestionList from '../../jsutils/suggestionList';
|
|
5
|
+
|
|
6
|
+
import { GraphQLError } from '../../error/GraphQLError';
|
|
7
|
+
|
|
7
8
|
import { type FieldNode } from '../../language/ast';
|
|
8
9
|
import { type ASTVisitor } from '../../language/visitor';
|
|
10
|
+
|
|
9
11
|
import { type GraphQLSchema } from '../../type/schema';
|
|
10
12
|
import {
|
|
11
13
|
type GraphQLOutputType,
|
|
@@ -14,6 +16,8 @@ import {
|
|
|
14
16
|
isAbstractType,
|
|
15
17
|
} from '../../type/definition';
|
|
16
18
|
|
|
19
|
+
import { type ValidationContext } from '../ValidationContext';
|
|
20
|
+
|
|
17
21
|
export function undefinedFieldMessage(
|
|
18
22
|
fieldName: string,
|
|
19
23
|
type: string,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GraphQLError } from '../../error/GraphQLError';
|
|
2
|
-
import suggestionList from '../../jsutils/suggestionList';
|
|
3
1
|
import didYouMean from '../../jsutils/didYouMean';
|
|
2
|
+
import suggestionList from '../../jsutils/suggestionList';
|
|
3
|
+
import { GraphQLError } from '../../error/GraphQLError';
|
|
4
4
|
import { isObjectType, isInterfaceType, isAbstractType } from '../../type/definition';
|
|
5
5
|
export function undefinedFieldMessage(fieldName, type, suggestedTypeNames, suggestedFieldNames) {
|
|
6
6
|
var quotedTypeNames = suggestedTypeNames.map(function (x) {
|
|
@@ -51,65 +51,29 @@ function getSuggestedTypeNames(schema, type, fieldName) {
|
|
|
51
51
|
if (isAbstractType(type)) {
|
|
52
52
|
var suggestedObjectTypes = [];
|
|
53
53
|
var interfaceUsageCount = Object.create(null);
|
|
54
|
-
var _iteratorNormalCompletion = true;
|
|
55
|
-
var _didIteratorError = false;
|
|
56
|
-
var _iteratorError = undefined;
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) {
|
|
56
|
+
var possibleType = _schema$getPossibleTy2[_i2];
|
|
57
|
+
|
|
58
|
+
if (!possibleType.getFields()[fieldName]) {
|
|
59
|
+
continue;
|
|
60
|
+
} // This object type defines this field.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
suggestedObjectTypes.push(possibleType.name);
|
|
64
|
+
|
|
65
|
+
for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) {
|
|
66
|
+
var possibleInterface = _possibleType$getInte2[_i4];
|
|
61
67
|
|
|
62
|
-
if (!
|
|
68
|
+
if (!possibleInterface.getFields()[fieldName]) {
|
|
63
69
|
continue;
|
|
64
|
-
} // This
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var _iteratorNormalCompletion2 = true;
|
|
69
|
-
var _didIteratorError2 = false;
|
|
70
|
-
var _iteratorError2 = undefined;
|
|
71
|
-
|
|
72
|
-
try {
|
|
73
|
-
for (var _iterator2 = possibleType.getInterfaces()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
74
|
-
var possibleInterface = _step2.value;
|
|
75
|
-
|
|
76
|
-
if (!possibleInterface.getFields()[fieldName]) {
|
|
77
|
-
continue;
|
|
78
|
-
} // This interface type defines this field.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
interfaceUsageCount[possibleInterface.name] = (interfaceUsageCount[possibleInterface.name] || 0) + 1;
|
|
82
|
-
}
|
|
83
|
-
} catch (err) {
|
|
84
|
-
_didIteratorError2 = true;
|
|
85
|
-
_iteratorError2 = err;
|
|
86
|
-
} finally {
|
|
87
|
-
try {
|
|
88
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
89
|
-
_iterator2.return();
|
|
90
|
-
}
|
|
91
|
-
} finally {
|
|
92
|
-
if (_didIteratorError2) {
|
|
93
|
-
throw _iteratorError2;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
} // Suggest interface types based on how common they are.
|
|
98
|
-
|
|
99
|
-
} catch (err) {
|
|
100
|
-
_didIteratorError = true;
|
|
101
|
-
_iteratorError = err;
|
|
102
|
-
} finally {
|
|
103
|
-
try {
|
|
104
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
105
|
-
_iterator.return();
|
|
106
|
-
}
|
|
107
|
-
} finally {
|
|
108
|
-
if (_didIteratorError) {
|
|
109
|
-
throw _iteratorError;
|
|
110
|
-
}
|
|
70
|
+
} // This interface type defines this field.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
interfaceUsageCount[possibleInterface.name] = (interfaceUsageCount[possibleInterface.name] || 0) + 1;
|
|
111
74
|
}
|
|
112
|
-
}
|
|
75
|
+
} // Suggest interface types based on how common they are.
|
|
76
|
+
|
|
113
77
|
|
|
114
78
|
var suggestedInterfaceTypes = Object.keys(interfaceUsageCount).sort(function (a, b) {
|
|
115
79
|
return interfaceUsageCount[b] - interfaceUsageCount[a];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ASTVisitor } from '../../language/visitor';
|
|
2
|
+
import { ValidationContext } from '../ValidationContext';
|
|
3
|
+
|
|
4
|
+
export function inlineFragmentOnNonCompositeErrorMessage(type: string): string;
|
|
5
|
+
|
|
6
|
+
export function fragmentOnNonCompositeErrorMessage(
|
|
7
|
+
fragName: string,
|
|
8
|
+
type: string,
|
|
9
|
+
): string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Fragments on composite type
|
|
13
|
+
*
|
|
14
|
+
* Fragments use a type condition to determine if they apply, since fragments
|
|
15
|
+
* can only be spread into a composite type (object, interface, or union), the
|
|
16
|
+
* type condition must also be a composite type.
|
|
17
|
+
*/
|
|
18
|
+
export function FragmentsOnCompositeTypes(
|
|
19
|
+
context: ValidationContext,
|
|
20
|
+
): ASTVisitor;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
|
|
3
|
-
import { type ValidationContext } from '../ValidationContext';
|
|
4
3
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
4
|
+
|
|
5
5
|
import { print } from '../../language/printer';
|
|
6
6
|
import { type ASTVisitor } from '../../language/visitor';
|
|
7
|
+
|
|
7
8
|
import { isCompositeType } from '../../type/definition';
|
|
9
|
+
|
|
8
10
|
import { typeFromAST } from '../../utilities/typeFromAST';
|
|
9
11
|
|
|
12
|
+
import { type ValidationContext } from '../ValidationContext';
|
|
13
|
+
|
|
10
14
|
export function inlineFragmentOnNonCompositeErrorMessage(type: string): string {
|
|
11
15
|
return `Fragment cannot condition on non composite type "${type}".`;
|
|
12
16
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ValidationContext, SDLValidationContext } from '../ValidationContext';
|
|
2
|
+
import { ASTVisitor } from '../../language/visitor';
|
|
3
|
+
|
|
4
|
+
export function unknownArgMessage(
|
|
5
|
+
argName: string,
|
|
6
|
+
fieldName: string,
|
|
7
|
+
typeName: string,
|
|
8
|
+
suggestedArgs: ReadonlyArray<string>,
|
|
9
|
+
): string;
|
|
10
|
+
|
|
11
|
+
export function unknownDirectiveArgMessage(
|
|
12
|
+
argName: string,
|
|
13
|
+
directiveName: string,
|
|
14
|
+
suggestedArgs: ReadonlyArray<string>,
|
|
15
|
+
): string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Known argument names
|
|
19
|
+
*
|
|
20
|
+
* A GraphQL field is only valid if all supplied arguments are defined by
|
|
21
|
+
* that field.
|
|
22
|
+
*/
|
|
23
|
+
export function KnownArgumentNames(context: ValidationContext): ASTVisitor;
|
|
24
|
+
|
|
25
|
+
// @internal
|
|
26
|
+
export function KnownArgumentNamesOnDirectives(
|
|
27
|
+
context: ValidationContext | SDLValidationContext,
|
|
28
|
+
): ASTVisitor;
|
|
@@ -8,11 +8,11 @@ exports.unknownDirectiveArgMessage = unknownDirectiveArgMessage;
|
|
|
8
8
|
exports.KnownArgumentNames = KnownArgumentNames;
|
|
9
9
|
exports.KnownArgumentNamesOnDirectives = KnownArgumentNamesOnDirectives;
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean"));
|
|
12
12
|
|
|
13
13
|
var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList"));
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _GraphQLError = require("../../error/GraphQLError");
|
|
16
16
|
|
|
17
17
|
var _kinds = require("../../language/kinds");
|
|
18
18
|
|
|
@@ -20,7 +20,9 @@ var _directives = require("../../type/directives");
|
|
|
20
20
|
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
22
|
|
|
23
|
-
function
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
|
|
25
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
24
26
|
|
|
25
27
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
28
|
|
|
@@ -66,59 +68,23 @@ function KnownArgumentNamesOnDirectives(context) {
|
|
|
66
68
|
var directiveArgs = Object.create(null);
|
|
67
69
|
var schema = context.getSchema();
|
|
68
70
|
var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives;
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var directive = _step.value;
|
|
76
|
-
directiveArgs[directive.name] = directive.args.map(function (arg) {
|
|
77
|
-
return arg.name;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
} catch (err) {
|
|
81
|
-
_didIteratorError = true;
|
|
82
|
-
_iteratorError = err;
|
|
83
|
-
} finally {
|
|
84
|
-
try {
|
|
85
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
86
|
-
_iterator.return();
|
|
87
|
-
}
|
|
88
|
-
} finally {
|
|
89
|
-
if (_didIteratorError) {
|
|
90
|
-
throw _iteratorError;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
71
|
+
|
|
72
|
+
for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) {
|
|
73
|
+
var directive = definedDirectives[_i2];
|
|
74
|
+
directiveArgs[directive.name] = directive.args.map(function (arg) {
|
|
75
|
+
return arg.name;
|
|
76
|
+
});
|
|
93
77
|
}
|
|
94
78
|
|
|
95
79
|
var astDefinitions = context.getDocument().definitions;
|
|
96
|
-
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) {
|
|
105
|
-
directiveArgs[def.name.value] = def.arguments ? def.arguments.map(function (arg) {
|
|
106
|
-
return arg.name.value;
|
|
107
|
-
}) : [];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
} catch (err) {
|
|
111
|
-
_didIteratorError2 = true;
|
|
112
|
-
_iteratorError2 = err;
|
|
113
|
-
} finally {
|
|
114
|
-
try {
|
|
115
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
116
|
-
_iterator2.return();
|
|
117
|
-
}
|
|
118
|
-
} finally {
|
|
119
|
-
if (_didIteratorError2) {
|
|
120
|
-
throw _iteratorError2;
|
|
121
|
-
}
|
|
80
|
+
|
|
81
|
+
for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) {
|
|
82
|
+
var def = astDefinitions[_i4];
|
|
83
|
+
|
|
84
|
+
if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) {
|
|
85
|
+
directiveArgs[def.name.value] = def.arguments ? def.arguments.map(function (arg) {
|
|
86
|
+
return arg.name.value;
|
|
87
|
+
}) : [];
|
|
122
88
|
}
|
|
123
89
|
}
|
|
124
90
|
|
|
@@ -128,32 +94,13 @@ function KnownArgumentNamesOnDirectives(context) {
|
|
|
128
94
|
var knownArgs = directiveArgs[directiveName];
|
|
129
95
|
|
|
130
96
|
if (directiveNode.arguments && knownArgs) {
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var argName = argNode.name.value;
|
|
139
|
-
|
|
140
|
-
if (knownArgs.indexOf(argName) === -1) {
|
|
141
|
-
var suggestions = (0, _suggestionList.default)(argName, knownArgs);
|
|
142
|
-
context.reportError(new _GraphQLError.GraphQLError(unknownDirectiveArgMessage(argName, directiveName, suggestions), argNode));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
} catch (err) {
|
|
146
|
-
_didIteratorError3 = true;
|
|
147
|
-
_iteratorError3 = err;
|
|
148
|
-
} finally {
|
|
149
|
-
try {
|
|
150
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
151
|
-
_iterator3.return();
|
|
152
|
-
}
|
|
153
|
-
} finally {
|
|
154
|
-
if (_didIteratorError3) {
|
|
155
|
-
throw _iteratorError3;
|
|
156
|
-
}
|
|
97
|
+
for (var _i6 = 0, _directiveNode$argume2 = directiveNode.arguments; _i6 < _directiveNode$argume2.length; _i6++) {
|
|
98
|
+
var argNode = _directiveNode$argume2[_i6];
|
|
99
|
+
var argName = argNode.name.value;
|
|
100
|
+
|
|
101
|
+
if (knownArgs.indexOf(argName) === -1) {
|
|
102
|
+
var suggestions = (0, _suggestionList.default)(argName, knownArgs);
|
|
103
|
+
context.reportError(new _GraphQLError.GraphQLError(unknownDirectiveArgMessage(argName, directiveName, suggestions), argNode));
|
|
157
104
|
}
|
|
158
105
|
}
|
|
159
106
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
|
|
3
|
+
import didYouMean from '../../jsutils/didYouMean';
|
|
4
|
+
import suggestionList from '../../jsutils/suggestionList';
|
|
5
|
+
|
|
6
|
+
import { GraphQLError } from '../../error/GraphQLError';
|
|
7
|
+
|
|
8
|
+
import { Kind } from '../../language/kinds';
|
|
9
|
+
import { type ASTVisitor } from '../../language/visitor';
|
|
10
|
+
|
|
11
|
+
import { specifiedDirectives } from '../../type/directives';
|
|
12
|
+
|
|
3
13
|
import {
|
|
4
14
|
type ValidationContext,
|
|
5
15
|
type SDLValidationContext,
|
|
6
16
|
} from '../ValidationContext';
|
|
7
|
-
import { GraphQLError } from '../../error/GraphQLError';
|
|
8
|
-
import { type ASTVisitor } from '../../language/visitor';
|
|
9
|
-
import suggestionList from '../../jsutils/suggestionList';
|
|
10
|
-
import didYouMean from '../../jsutils/didYouMean';
|
|
11
|
-
import { Kind } from '../../language/kinds';
|
|
12
|
-
import { specifiedDirectives } from '../../type/directives';
|
|
13
17
|
|
|
14
18
|
export function unknownArgMessage(
|
|
15
19
|
argName: string,
|