lib/graphql/query/literal_input.rb in graphql-1.7.7 vs lib/graphql/query/literal_input.rb in graphql-1.7.8
- old
+ new
@@ -47,10 +47,12 @@
end
def self.from_arguments(ast_arguments, argument_owner, variables)
context = variables ? variables.context : nil
values_hash = {}
+ defaults_used = Set.new
+
indexed_arguments = case ast_arguments
when Hash
ast_arguments
when Array
ast_arguments.each_with_object({}) { |a, memo| memo[a.name] = a }
@@ -91,10 +93,11 @@
# If the definition has a default value and
# a value wasn't provided from the AST,
# then add the default value.
if arg_defn.default_value? && !values_hash.key?(arg_name)
value = arg_defn.default_value
+ defaults_used << arg_name
# `context` isn't present when pre-calculating defaults
if context
value = arg_defn.prepare(value, context)
if value.is_a?(GraphQL::ExecutionError)
value.ast_node = ast_arg
@@ -103,10 +106,10 @@
end
values_hash[arg_name] = value
end
end
- argument_owner.arguments_class.new(values_hash)
+ argument_owner.arguments_class.new(values_hash, defaults_used)
end
end
end
end