@@ -45,10 +45,6 @@ import { specifiedRules } from './specifiedRules';
45
45
* Each validation rules is a function which returns a visitor
46
46
* (see the language/visitor API). Visitor methods are expected to return
47
47
* GraphQLErrors, or Arrays of GraphQLErrors when invalid.
48
- *
49
- * Visitors can also supply `visitSpreadFragments: true` which will alter the
50
- * behavior of the visitor to skip over top level defined fragments, and instead
51
- * visit those fragments at every point a spread is encountered.
52
48
*/
53
49
export function validate (
54
50
schema : GraphQLSchema ,
@@ -82,38 +78,14 @@ export function visitUsingRules(
82
78
83
79
function visitInstance ( ast , instance ) {
84
80
visit ( ast , {
85
- enter ( node , key ) {
81
+ enter ( node ) {
86
82
// Collect type information about the current position in the AST.
87
83
typeInfo . enter ( node ) ;
88
84
89
- // Do not visit top level fragment definitions if this instance will
90
- // visit those fragments inline because it
91
- // provided `visitSpreadFragments`.
92
- var result ;
93
- if (
94
- node . kind === Kind . FRAGMENT_DEFINITION &&
95
- key !== undefined &&
96
- instance . visitSpreadFragments
97
- ) {
98
- return false ;
99
- }
100
-
101
85
// Get the visitor function from the validation instance, and if it
102
86
// exists, call it with the visitor arguments.
103
87
var enter = getVisitFn ( instance , false , node . kind ) ;
104
- result = enter ? enter . apply ( instance , arguments ) : undefined ;
105
-
106
- // If any validation instances provide the flag `visitSpreadFragments`
107
- // and this node is a fragment spread, visit the fragment definition
108
- // from this point.
109
- if ( result === undefined &&
110
- instance . visitSpreadFragments &&
111
- node . kind === Kind . FRAGMENT_SPREAD ) {
112
- var fragment = context . getFragment ( node . name . value ) ;
113
- if ( fragment ) {
114
- visitInstance ( fragment , instance ) ;
115
- }
116
- }
88
+ var result = enter ? enter . apply ( instance , arguments ) : undefined ;
117
89
118
90
// If the result is "false", we're not visiting any descendent nodes,
119
91
// but need to update typeInfo.
0 commit comments