graphql 2.5.4 → 2.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fcafc24832a376132e4f15c981133f693685ad070918284587f775d05dd44d7
4
- data.tar.gz: 41bba1c56371a6d4ad643f75cece09cc13474dcf02b24dce0b31a1c8c89ee480
3
+ metadata.gz: 170be4878ee16ebea26a272dde50923d35e624c87e1154b34de61a10f6a9fae0
4
+ data.tar.gz: 5ac223538670c8a24c2748e0819cab3b5e0627c14b4a4745559fdedfcd8440fb
5
5
  SHA512:
6
- metadata.gz: 308136d27234edd6c84310f1e18d5a5841cdbcbf7ca8fe56eb9dd070fa52c10ad6d4d46022b51d22fe4adbcae9f7428ea6a6d7b756eef5d2be1f1337393a3f3b
7
- data.tar.gz: a0a3027d2f155daa8e52156765f6f6dcd53b35057ba010cc9e0ece130c283e2a5292c020eee81882074b6e7524c0085670dba9d47337619279915df18e097655
6
+ metadata.gz: 272a8d48f0ec1d0ad1a79021dc103aede933d34a35829512bf0d46bcbcbc3bafe3b3484cbd38c26ba8193144f3a4024c1c69bd732c9e4cf472307fd15c1d1a33
7
+ data.tar.gz: b1a66e945b02251b72410c792a91ba5d28cbe82e3eba3891bd3a708382076c2da9e6cf1349c3b688a0f7f87ba06d9bb1b83d06e4c3282e47c0c9724d76cb187b
@@ -28,14 +28,14 @@ module GraphQL
28
28
  end
29
29
  when nil
30
30
  subject.logger.warn <<~GRAPHQL
31
- GraphQL-Ruby's complexity cost system is getting some "breaking fixes" in a future version. See the migration notes at https://graphql-ruby.org/api-docs/#{GraphQL::VERSION}/Schema.html#complexity_cost_cacluation_mode-class_method
31
+ GraphQL-Ruby's complexity cost system is getting some "breaking fixes" in a future version. See the migration notes at https://graphql-ruby.org/api-doc/#{GraphQL::VERSION}/GraphQL/Schema.html#complexity_cost_calculation_mode_for-class_method
32
32
 
33
33
  To opt into the future behavior, configure your schema (#{subject.schema.name ? subject.schema.name : subject.schema.ancestors}) with:
34
34
 
35
35
  complexity_cost_calculation_mode(:future) # or `:legacy`, `:compare`
36
36
 
37
37
  GRAPHQL
38
- max_possible_complexity
38
+ max_possible_complexity(mode: :legacy)
39
39
  else
40
40
  raise ArgumentError, "Expected `:future`, `:legacy`, `:compare`, or `nil` from `#{query.schema}.complexity_cost_calculation_mode_for` but got: #{query.schema.complexity_cost_calculation_mode.inspect}"
41
41
  end
@@ -176,30 +176,33 @@ module GraphQL
176
176
  return GraphQL::Query::InputValidationResult.from_problem(INVALID_OBJECT_MESSAGE % { object: JSON.generate(input, quirks_mode: true) })
177
177
  end
178
178
 
179
- # Inject missing required arguments
180
- missing_required_inputs = ctx.types.arguments(self).reduce({}) do |m, (argument)|
181
- if !input.key?(argument.graphql_name) && argument.type.non_null? && !argument.default_value? && types.argument(self, argument.graphql_name)
182
- m[argument.graphql_name] = nil
183
- end
184
-
185
- m
186
- end
187
179
 
188
180
  result = nil
189
- [input, missing_required_inputs].each do |args_to_validate|
190
- args_to_validate.each do |argument_name, value|
191
- argument = types.argument(self, argument_name)
192
- # Items in the input that are unexpected
193
- if argument.nil?
194
- result ||= Query::InputValidationResult.new
195
- result.add_problem("Field is not defined on #{self.graphql_name}", [argument_name])
196
- else
197
- # Items in the input that are expected, but have invalid values
198
- argument_result = argument.type.validate_input(value, ctx)
181
+
182
+
183
+ input.each do |argument_name, value|
184
+ argument = types.argument(self, argument_name)
185
+ # Items in the input that are unexpected
186
+ if argument.nil?
187
+ result ||= Query::InputValidationResult.new
188
+ result.add_problem("Field is not defined on #{self.graphql_name}", [argument_name])
189
+ else
190
+ # Items in the input that are expected, but have invalid values
191
+ argument_result = argument.type.validate_input(value, ctx)
192
+ if !argument_result.valid?
199
193
  result ||= Query::InputValidationResult.new
200
- if !argument_result.valid?
201
- result.merge_result!(argument_name, argument_result)
202
- end
194
+ result.merge_result!(argument_name, argument_result)
195
+ end
196
+ end
197
+ end
198
+
199
+ # Check for missing non-null arguments
200
+ ctx.types.arguments(self).each do |argument|
201
+ if !input.key?(argument.graphql_name) && argument.type.non_null? && !argument.default_value?
202
+ result ||= Query::InputValidationResult.new
203
+ argument_result = argument.type.validate_input(nil, ctx)
204
+ if !argument_result.valid?
205
+ result.merge_result!(argument.graphql_name, argument_result)
203
206
  end
204
207
  end
205
208
  end
@@ -12,7 +12,7 @@ module GraphQL
12
12
  # @param profiles [Hash<Symbol => Hash>] A hash of `name => context` pairs for preloading visibility profiles
13
13
  # @param preload [Boolean] if `true`, load the default schema profile and all named profiles immediately (defaults to `true` for `Rails.env.production?`)
14
14
  # @param migration_errors [Boolean] if `true`, raise an error when `Visibility` and `Warden` return different results
15
- def self.use(schema, dynamic: false, profiles: EmptyObjects::EMPTY_HASH, preload: (defined?(Rails) ? Rails.env.production? : nil), migration_errors: false)
15
+ def self.use(schema, dynamic: false, profiles: EmptyObjects::EMPTY_HASH, preload: (defined?(Rails.env) ? Rails.env.production? : nil), migration_errors: false)
16
16
  profiles&.each { |name, ctx|
17
17
  ctx[:visibility_profile] = name
18
18
  ctx.freeze
@@ -137,7 +137,9 @@ module GraphQL
137
137
 
138
138
  def dataloader_fiber_resume(source)
139
139
  prev_ev = Fiber[PREVIOUS_EV_KEY]
140
- begin_notifications_event(prev_ev.name, prev_ev.payload)
140
+ if prev_ev
141
+ begin_notifications_event(prev_ev.name, prev_ev.payload)
142
+ end
141
143
  super
142
144
  end
143
145
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.5.4"
3
+ VERSION = "2.5.5"
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.4
4
+ version: 2.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-18 00:00:00.000000000 Z
10
+ date: 2025-04-29 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: base64
@@ -163,6 +163,20 @@ dependencies:
163
163
  - - ">="
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
+ - !ruby/object:Gem::Dependency
167
+ name: ostruct
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ type: :development
174
+ prerelease: false
175
+ version_requirements: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
166
180
  - !ruby/object:Gem::Dependency
167
181
  name: rake
168
182
  requirement: !ruby/object:Gem::Requirement
@@ -801,7 +815,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
801
815
  - !ruby/object:Gem::Version
802
816
  version: '0'
803
817
  requirements: []
804
- rubygems_version: 3.6.6
818
+ rubygems_version: 3.6.8
805
819
  specification_version: 4
806
820
  summary: A GraphQL language and runtime for Ruby
807
821
  test_files: []