diff --git a/lib/graphql/query/variables.rb b/lib/graphql/query/variables.rb index 6fbc73192e..4b2c12e091 100644 --- a/lib/graphql/query/variables.rb +++ b/lib/graphql/query/variables.rb @@ -19,7 +19,7 @@ def initialize(ctx, ast_variables, provided_variables) @storage = ast_variables.each_with_object({}) do |ast_variable, memo| if schema.validate_max_errors && schema.validate_max_errors <= @errors.count add_max_errors_reached_message - break + break memo end # Find the right value for this variable: # - First, use the value provided at runtime diff --git a/spec/graphql/query/variables_spec.rb b/spec/graphql/query/variables_spec.rb index b9118d3fdb..d58adc316c 100644 --- a/spec/graphql/query/variables_spec.rb +++ b/spec/graphql/query/variables_spec.rb @@ -57,6 +57,7 @@ class TestSchema < VariablesTest::MaxValidationSchema res = schema.execute(query_string, variables: variables) assert_equal 3, res["errors"].count assert_match(/Too many errors processing variables/, res["errors"].last["message"]) + assert_equal 0, res.query.variables.length end end