forked from graphql/graphql-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspecifiedRules.js
138 lines (108 loc) · 4.64 KB
/
specifiedRules.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
*/
import type { ValidationRule, SDLValidationRule } from './ValidationContext';
// Spec Section: "Executable Definitions"
import { ExecutableDefinitions } from './rules/ExecutableDefinitions';
// Spec Section: "Operation Name Uniqueness"
import { UniqueOperationNames } from './rules/UniqueOperationNames';
// Spec Section: "Lone Anonymous Operation"
import { LoneAnonymousOperation } from './rules/LoneAnonymousOperation';
// Spec Section: "Subscriptions with Single Root Field"
import { SingleFieldSubscriptions } from './rules/SingleFieldSubscriptions';
// Spec Section: "Fragment Spread Type Existence"
import { KnownTypeNames } from './rules/KnownTypeNames';
// Spec Section: "Fragments on Composite Types"
import { FragmentsOnCompositeTypes } from './rules/FragmentsOnCompositeTypes';
// Spec Section: "Variables are Input Types"
import { VariablesAreInputTypes } from './rules/VariablesAreInputTypes';
// Spec Section: "Leaf Field Selections"
import { ScalarLeafs } from './rules/ScalarLeafs';
// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types"
import { FieldsOnCorrectType } from './rules/FieldsOnCorrectType';
// Spec Section: "Fragment Name Uniqueness"
import { UniqueFragmentNames } from './rules/UniqueFragmentNames';
// Spec Section: "Fragment spread target defined"
import { KnownFragmentNames } from './rules/KnownFragmentNames';
// Spec Section: "Fragments must be used"
import { NoUnusedFragments } from './rules/NoUnusedFragments';
// Spec Section: "Fragment spread is possible"
import { PossibleFragmentSpreads } from './rules/PossibleFragmentSpreads';
// Spec Section: "Fragments must not form cycles"
import { NoFragmentCycles } from './rules/NoFragmentCycles';
// Spec Section: "Variable Uniqueness"
import { UniqueVariableNames } from './rules/UniqueVariableNames';
// Spec Section: "All Variable Used Defined"
import { NoUndefinedVariables } from './rules/NoUndefinedVariables';
// Spec Section: "All Variables Used"
import { NoUnusedVariables } from './rules/NoUnusedVariables';
// Spec Section: "Directives Are Defined"
import { KnownDirectives } from './rules/KnownDirectives';
// Spec Section: "Directives Are Unique Per Location"
import { UniqueDirectivesPerLocation } from './rules/UniqueDirectivesPerLocation';
// Spec Section: "Argument Names"
import { KnownArgumentNames } from './rules/KnownArgumentNames';
// Spec Section: "Argument Uniqueness"
import { UniqueArgumentNames } from './rules/UniqueArgumentNames';
// Spec Section: "Value Type Correctness"
import { ValuesOfCorrectType } from './rules/ValuesOfCorrectType';
// Spec Section: "Argument Optionality"
import { ProvidedRequiredArguments } from './rules/ProvidedRequiredArguments';
// Spec Section: "All Variable Usages Are Allowed"
import { VariablesInAllowedPosition } from './rules/VariablesInAllowedPosition';
// Spec Section: "Field Selection Merging"
import { OverlappingFieldsCanBeMerged } from './rules/OverlappingFieldsCanBeMerged';
// Spec Section: "Input Object Field Uniqueness"
import { UniqueInputFieldNames } from './rules/UniqueInputFieldNames';
/**
* This set includes all validation rules defined by the GraphQL spec.
*
* The order of the rules in this list has been adjusted to lead to the
* most clear output when encountering multiple validation errors.
*/
export const specifiedRules: $ReadOnlyArray<ValidationRule> = [
ExecutableDefinitions,
UniqueOperationNames,
LoneAnonymousOperation,
SingleFieldSubscriptions,
KnownTypeNames,
FragmentsOnCompositeTypes,
VariablesAreInputTypes,
ScalarLeafs,
FieldsOnCorrectType,
UniqueFragmentNames,
KnownFragmentNames,
NoUnusedFragments,
PossibleFragmentSpreads,
NoFragmentCycles,
UniqueVariableNames,
NoUndefinedVariables,
NoUnusedVariables,
KnownDirectives,
UniqueDirectivesPerLocation,
KnownArgumentNames,
UniqueArgumentNames,
ValuesOfCorrectType,
ProvidedRequiredArguments,
VariablesInAllowedPosition,
OverlappingFieldsCanBeMerged,
UniqueInputFieldNames,
];
import { LoneSchemaDefinition } from './rules/LoneSchemaDefinition';
import { KnownArgumentNamesOnDirectives } from './rules/KnownArgumentNames';
import { ProvidedRequiredArgumentsOnDirectives } from './rules/ProvidedRequiredArguments';
// @internal
export const specifiedSDLRules: $ReadOnlyArray<SDLValidationRule> = [
LoneSchemaDefinition,
KnownDirectives,
UniqueDirectivesPerLocation,
KnownArgumentNamesOnDirectives,
UniqueArgumentNames,
UniqueInputFieldNames,
ProvidedRequiredArgumentsOnDirectives,
];