lib/graphql/analysis/ast/field_usage.rb in graphql-1.12.24 vs lib/graphql/analysis/ast/field_usage.rb in graphql-1.13.0
- old
+ new
@@ -13,16 +13,12 @@
def on_leave_field(node, parent, visitor)
field_defn = visitor.field_definition
field = "#{visitor.parent_type_definition.graphql_name}.#{field_defn.graphql_name}"
@used_fields << field
@used_deprecated_fields << field if field_defn.deprecation_reason
- arguments = visitor.query.arguments_for(node, visitor.field_definition)
- # If there was an error when preparing this argument object,
- # then this might be an error or something:
- if arguments.respond_to?(:argument_values)
- extract_deprecated_arguments(arguments.argument_values)
- end
+
+ extract_deprecated_arguments(visitor.query.arguments_for(node, visitor.field_definition).argument_values)
end
def result
{
used_fields: @used_fields.to_a,
@@ -38,15 +34,15 @@
if argument.definition.deprecation_reason
@used_deprecated_arguments << argument.definition.path
end
if argument.definition.type.kind.input_object?
- extract_deprecated_arguments(argument.value.arguments.argument_values)
+ extract_deprecated_arguments(argument.value.arguments.argument_values) # rubocop:disable Development/ContextIsPassedCop -- runtime args instance
elsif argument.definition.type.list? && !argument.value.nil?
argument
.value
.select { |value| value.respond_to?(:arguments) }
- .each { |value| extract_deprecated_arguments(value.arguments.argument_values) }
+ .each { |value| extract_deprecated_arguments(value.arguments.argument_values) } # rubocop:disable Development/ContextIsPassedCop -- runtime args instance
end
end
end
end
end