File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -227,22 +227,26 @@ class ValidateExecutableVisitor
227227 using OperationVariables = std::optional<VariableTypes>;
228228 using VariableSet = std::set<std::string>;
229229
230+ // These members store Introspection schema information which does not change between queries.
230231 OperationTypes _operationTypes;
231232 ValidateTypeKinds _typeKinds;
232233 MatchingTypes _matchingTypes;
233234 Directives _directives;
234235 EnumValues _enumValues;
235236 ScalarTypes _scalarTypes;
236237
238+ // These members store information that's specific to a single query and changes every time we
239+ // visit a new one. They must be reset in between queries.
237240 ExecutableNodes _fragmentDefinitions;
238241 ExecutableNodes _operationDefinitions;
242+ FragmentSet _referencedFragments;
243+ FragmentSet _fragmentCycles;
239244
245+ // These members store state for the visitor. They implicitly reset each time we call visit.
240246 OperationVariables _operationVariables;
241247 VariableDefinitions _variableDefinitions;
242248 VariableSet _referencedVariables;
243- FragmentSet _referencedFragments;
244249 FragmentSet _fragmentStack;
245- FragmentSet _fragmentCycles;
246250 size_t _fieldCount = 0 ;
247251 TypeFields _typeFields;
248252 InputTypeFields _inputTypeFields;
Original file line number Diff line number Diff line change @@ -792,6 +792,12 @@ std::vector<schema_error> ValidateExecutableVisitor::getStructuredErrors()
792792{
793793 auto errors = std::move (_errors);
794794
795+ // Reset all of the state for this query, but keep the Introspection schema information.
796+ _fragmentDefinitions.clear ();
797+ _operationDefinitions.clear ();
798+ _referencedFragments.clear ();
799+ _fragmentCycles.clear ();
800+
795801 return errors;
796802}
797803
You can’t perform that action at this time.
0 commit comments