Skip to content

Commit 8a8e189

Browse files
committed
Include the explanation too
1 parent f791d19 commit 8a8e189

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/graphql/query/variable_validation_error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def problem_fields
3737
@problem_fields ||= @validation_result
3838
.problems
3939
.reject { |problem| problem["path"].empty? }
40-
.map { |problem| problem["path"].join(".") }
40+
.map { |problem| "#{problem['path'].join('.')} (#{problem['explanation']})" }
4141
end
4242
end
4343
end

spec/graphql/query/executor_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@
275275
expected = {
276276
"errors"=>[
277277
{
278-
"message" => "Variable input of type ReplaceValuesInput! was provided invalid value for values",
278+
"message" => "Variable input of type ReplaceValuesInput! was provided invalid value for values (Expected value to not be null)",
279279
"locations" => [{ "line" => 1, "column" => 13 }],
280280
"extensions" => {
281281
"value" => {},
@@ -295,7 +295,7 @@
295295
expected = {
296296
"errors"=>[
297297
{
298-
"message" => "Variable input of type [DairyProductInput] was provided invalid value for 0.foo, 0.source",
298+
"message" => "Variable input of type [DairyProductInput] was provided invalid value for 0.foo (Field is not defined on DairyProductInput), 0.source (Expected value to not be null)",
299299
"locations" => [{ "line" => 1, "column" => 10 }],
300300
"extensions" => {
301301
"value" => [{ "foo" => "bar" }],

spec/graphql/schema/warden_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ def error_messages(query_result)
817817
res = MaskHelpers.query_with_mask(query_string, mask, variables: { "manners" => ["STOP", "TRILL"] })
818818
# It's not a good error message ... but it's something!
819819
expected_errors = [
820-
"Variable manners of type [Manner!]! was provided invalid value for 1",
820+
"Variable manners of type [Manner!]! was provided invalid value for 1 (Expected \"TRILL\" to be one of: STOP, AFFRICATE, FRICATIVE, APPROXIMANT, VOWEL)",
821821
]
822822
assert_equal expected_errors, error_messages(res)
823823
end

0 commit comments

Comments
 (0)