@@ -95,7 +95,7 @@ type ValidationContext struct {
95
95
variableUsages map [HasSelectionSet ][]* VariableUsage
96
96
recursiveVariableUsages map [* ast.OperationDefinition ][]* VariableUsage
97
97
recursivelyReferencedFragments map [* ast.OperationDefinition ][]* ast.FragmentDefinition
98
- fragmentSpreads map [HasSelectionSet ][]* ast.FragmentSpread
98
+ fragmentSpreads map [* ast. SelectionSet ][]* ast.FragmentSpread
99
99
}
100
100
101
101
func NewValidationContext (schema * Schema , astDoc * ast.Document , typeInfo * TypeInfo ) * ValidationContext {
@@ -107,7 +107,7 @@ func NewValidationContext(schema *Schema, astDoc *ast.Document, typeInfo *TypeIn
107
107
variableUsages : map [HasSelectionSet ][]* VariableUsage {},
108
108
recursiveVariableUsages : map [* ast.OperationDefinition ][]* VariableUsage {},
109
109
recursivelyReferencedFragments : map [* ast.OperationDefinition ][]* ast.FragmentDefinition {},
110
- fragmentSpreads : map [HasSelectionSet ][]* ast.FragmentSpread {},
110
+ fragmentSpreads : map [* ast. SelectionSet ][]* ast.FragmentSpread {},
111
111
}
112
112
}
113
113
@@ -146,13 +146,13 @@ func (ctx *ValidationContext) Fragment(name string) *ast.FragmentDefinition {
146
146
f , _ := ctx .fragments [name ]
147
147
return f
148
148
}
149
- func (ctx * ValidationContext ) FragmentSpreads (node HasSelectionSet ) []* ast.FragmentSpread {
149
+ func (ctx * ValidationContext ) FragmentSpreads (node * ast. SelectionSet ) []* ast.FragmentSpread {
150
150
if spreads , ok := ctx .fragmentSpreads [node ]; ok && spreads != nil {
151
151
return spreads
152
152
}
153
153
154
154
spreads := []* ast.FragmentSpread {}
155
- setsToVisit := []* ast.SelectionSet {node . GetSelectionSet () }
155
+ setsToVisit := []* ast.SelectionSet {node }
156
156
157
157
for {
158
158
if len (setsToVisit ) == 0 {
@@ -189,14 +189,14 @@ func (ctx *ValidationContext) RecursivelyReferencedFragments(operation *ast.Oper
189
189
190
190
fragments := []* ast.FragmentDefinition {}
191
191
collectedNames := map [string ]bool {}
192
- nodesToVisit := []HasSelectionSet {operation }
192
+ nodesToVisit := []* ast. SelectionSet {operation . SelectionSet }
193
193
194
194
for {
195
195
if len (nodesToVisit ) == 0 {
196
196
break
197
197
}
198
198
199
- var node HasSelectionSet
199
+ var node * ast. SelectionSet
200
200
201
201
node , nodesToVisit = nodesToVisit [len (nodesToVisit )- 1 ], nodesToVisit [:len (nodesToVisit )- 1 ]
202
202
spreads := ctx .FragmentSpreads (node )
@@ -210,7 +210,7 @@ func (ctx *ValidationContext) RecursivelyReferencedFragments(operation *ast.Oper
210
210
fragment := ctx .Fragment (fragName )
211
211
if fragment != nil {
212
212
fragments = append (fragments , fragment )
213
- nodesToVisit = append (nodesToVisit , fragment )
213
+ nodesToVisit = append (nodesToVisit , fragment . SelectionSet )
214
214
}
215
215
}
216
216
0 commit comments