graphql 1.13.16 → 1.13.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c562e63d8324130b431892094e4a85a45f62187ae41a08fa095f854283950c28
4
- data.tar.gz: c38c9220f5878fe45738d0e0d9c23062c1d7c9a1b744c58d7b5b169819adabed
3
+ metadata.gz: 06b422e884c0286eca2020124a83dbc02a1ac4dbf905b48f9d125fb4c2569eff
4
+ data.tar.gz: a4985d6e8e3cd0358f3afac1bd1d8023e24d4ed63e2be8f05557ec2822e69447
5
5
  SHA512:
6
- metadata.gz: 2597fa87c4b752878e60b6d4c809385a67e3d4192fac54fc23a97e92ba1b580531364270409f3aefb048f26fd79a764cf4c54278f85f85cb5b76b363072926f1
7
- data.tar.gz: f40d8e5aefbdc97884e0e104bbb52bb599e3aa9f690e540b0d99f00d4dc70ed07b56b08c6a1a4ed06e0b275c1b1589242413b131f80185e908d9bddd94b3106c
6
+ metadata.gz: e7f61649fd57f66798a84eb713058add79cdff52bb49ad7dfbdaa328111d0288fc5154b2ee991ddbd77914fb80e9d0bced518ffdc21d92f801ab1b68bbf4add2
7
+ data.tar.gz: abb11a3b18e52544af8726152fab0f145e214f88521121ac775ba2e0fb0e0f22c9988406548cfde267df314ca58063a4d4130d29f53b236170312e0b806c28d0
@@ -258,6 +258,10 @@ module GraphQL
258
258
  # TODO: I think non-string/symbol hash keys are wrongly normalized (eg `1` will not work)
259
259
  method_name = method || hash_key || name_s
260
260
  @dig_keys = dig
261
+ if hash_key
262
+ @hash_key = hash_key
263
+ end
264
+
261
265
  resolver_method ||= name_s.to_sym
262
266
 
263
267
  @method_str = -method_name.to_s
@@ -473,7 +477,13 @@ module GraphQL
473
477
  case defined_complexity
474
478
  when Proc
475
479
  arguments = query.arguments_for(nodes.first, self)
476
- defined_complexity.call(query.context, arguments.keyword_arguments, child_complexity)
480
+ if arguments.is_a?(GraphQL::ExecutionError)
481
+ return child_complexity
482
+ elsif arguments.respond_to?(:keyword_arguments)
483
+ arguments = arguments.keyword_arguments
484
+ end
485
+
486
+ defined_complexity.call(query.context, arguments, child_complexity)
477
487
  when Numeric
478
488
  defined_complexity + child_complexity
479
489
  else
@@ -816,7 +826,7 @@ module GraphQL
816
826
  # Find a way to resolve this field, checking:
817
827
  #
818
828
  # - A method on the type instance;
819
- # - Hash keys, if the wrapped object is a hash;
829
+ # - Hash keys, if the wrapped object is a hash or responds to `#[]`
820
830
  # - A method on the wrapped object;
821
831
  # - Or, raise not implemented.
822
832
  #
@@ -838,6 +848,8 @@ module GraphQL
838
848
  else
839
849
  inner_object[@method_str]
840
850
  end
851
+ elsif defined?(@hash_key) && obj.object.respond_to?(:[])
852
+ obj.object[@hash_key]
841
853
  elsif obj.object.respond_to?(@method_sym)
842
854
  method_to_call = @method_sym
843
855
  method_receiver = obj.object
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "1.13.16"
3
+ VERSION = "1.13.18"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.16
4
+ version: 1.13.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-31 00:00:00.000000000 Z
11
+ date: 2023-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -722,7 +722,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
722
722
  - !ruby/object:Gem::Version
723
723
  version: '0'
724
724
  requirements: []
725
- rubygems_version: 3.2.22
725
+ rubygems_version: 3.3.3
726
726
  signing_key:
727
727
  specification_version: 4
728
728
  summary: A GraphQL language and runtime for Ruby