lib/graphql/subscriptions.rb in graphql-2.3.16 vs lib/graphql/subscriptions.rb in graphql-2.3.17
- old
+ new
@@ -248,10 +248,12 @@
# @param args [Hash, Array, Any] some GraphQL input value to coerce as `arg_owner`
# @return [Any] normalized arguments value
def normalize_arguments(event_name, arg_owner, args, context)
case arg_owner
when GraphQL::Schema::Field, Class
+ return args if args.nil?
+
if arg_owner.is_a?(Class) && !arg_owner.kind.input_object?
# it's a type, but not an input object
return args
end
normalized_args = {}
@@ -300,10 +302,10 @@
raise InvalidTriggerError, "Can't trigger Subscription.#{event_name}, received undefined arguments: #{missing_arg_names.join(", ")}. (Should match arguments of #{arg_owner_name}.)"
end
normalized_args
when GraphQL::Schema::List
- args.map { |a| normalize_arguments(event_name, arg_owner.of_type, a, context) }
+ args&.map { |a| normalize_arguments(event_name, arg_owner.of_type, a, context) }
when GraphQL::Schema::NonNull
normalize_arguments(event_name, arg_owner.of_type, args, context)
else
args
end