Skip to content

Commit 2db5c92

Browse files
committed
fix: skip argument evaluation when value is a prepared value
1 parent ba3fb77 commit 2db5c92

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/graphql/analysis/ast/field_usage.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def extract_deprecated_arguments(argument_values)
4848
argument_type = argument_type.of_type
4949
end
5050

51-
if argument_type.kind.input_object?
51+
if argument_type.kind.input_object? && argument.value.respond_to?(:arguments) # Skip if value is not a GraphQL::Schema::InputObject
5252
extract_deprecated_arguments(argument.value.arguments.argument_values) # rubocop:disable Development/ContextIsPassedCop -- runtime args instance
5353
elsif argument_type.kind.enum?
5454
extract_deprecated_enum_value(argument_type, argument.value)

spec/graphql/analysis/ast/field_usage_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,15 @@
254254
end
255255
end
256256

257-
describe "mutation with deprecated arguments with prepared values" do
257+
describe "mutation with deprecated arguments with prepared values does not break" do
258258
let(:query_string) {%|
259259
mutation {
260260
pushValue(preparedTestInput: { deprecatedDate: "2020-10-10" })
261261
}
262262
|}
263263

264-
it "keeps track of nested deprecated arguments" do
265-
assert_equal ['PreparedDateInput.deprecatedDate'], result[:used_deprecated_arguments]
264+
it "does not keeps track of nested deprecated arguments" do
265+
assert_equal [], result[:used_deprecated_arguments]
266266
end
267267
end
268268

0 commit comments

Comments
 (0)