graphql 2.5.8 → 2.5.9

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: 35ee0d9a05997b264c746c531a4ff8d86ae9c8a4990523319da5ffafc9c89246
4
- data.tar.gz: e68bf5323cff52c65403b4ed34a90de85a1f8b660d95cd43c167aeba2bce2d51
3
+ metadata.gz: 2d6def5d638ca63c24df116117624ac5bd6e87555457a38fb893a43a1b15600f
4
+ data.tar.gz: c74e1ae2276871b07decc70422ff48992d8a5c9c9bdbce23164b367c707fe078
5
5
  SHA512:
6
- metadata.gz: 7233e64a37086b088d22609117498fcc12992472bde573a0a08b31d579121e9062759deac9ca22394273d28f914c04042dbbe53ba94a90859d0e82d75cc3c25a
7
- data.tar.gz: bdeefc1210bcac49daef9670cfb53047c1d048e07ca2c68d6b31936e737f11314ac4cb6dbb6dc3063200f472379980fca42dfa997b44202ee56e5e1a6c525a9e
6
+ metadata.gz: 333fdffd66163025d3dce807a12f7b2aeaceb932b5bd739d077a4d6d9ccbee92e891a24e68a8fb94f3f1157edc93abc01ac71fbef4ef0b64e2fc043ea4119488
7
+ data.tar.gz: c22ba9de28b9124a1d758ffd9f71a7b49da20780c55bc9ceda9fdb74d93042df17eeccb8b74cf7eba9a095bd9852a19e0673c85e473da509379f4520cb695da7
@@ -675,6 +675,8 @@ module GraphQL
675
675
  when "SCALAR", "ENUM"
676
676
  r = begin
677
677
  current_type.coerce_result(value, context)
678
+ rescue GraphQL::ExecutionError => ex_err
679
+ return continue_value(ex_err, field, is_non_null, ast_node, result_name, selection_result)
678
680
  rescue StandardError => err
679
681
  query.handle_or_reraise(err)
680
682
  end
@@ -129,8 +129,20 @@ module GraphQL
129
129
  # not runtime arguments.
130
130
  context = Query::NullContext.instance
131
131
  self.class.all_argument_definitions.each do |arg_defn|
132
- value = arguments[arg_defn.keyword]
133
- result = arg_defn.type.validate_input(value, context)
132
+ if arguments.key?(arg_defn.keyword)
133
+ value = arguments[arg_defn.keyword]
134
+ # This is a Ruby-land value; convert it to graphql for validation
135
+ graphql_value = begin
136
+ arg_defn.type.unwrap.coerce_isolated_result(value)
137
+ rescue GraphQL::Schema::Enum::UnresolvedValueError
138
+ # Let validation handle this
139
+ value
140
+ end
141
+ else
142
+ value = graphql_value = nil
143
+ end
144
+
145
+ result = arg_defn.type.validate_input(graphql_value, context)
134
146
  if !result.valid?
135
147
  raise InvalidArgumentError, "@#{graphql_name}.#{arg_defn.graphql_name} on #{owner.path} is invalid (#{value.inspect}): #{result.problems.first["explanation"]}"
136
148
  end
@@ -370,8 +370,8 @@ module GraphQL
370
370
  end
371
371
 
372
372
  passes_possible_types_check = if context.types.loadable?(arg_loads_type, context)
373
- if arg_loads_type.kind.union?
374
- # This union is used in `loads:` but not otherwise visible to this query
373
+ if arg_loads_type.kind.abstract?
374
+ # This union/interface is used in `loads:` but not otherwise visible to this query
375
375
  context.types.loadable_possible_types(arg_loads_type, context).include?(application_object_type)
376
376
  else
377
377
  true
@@ -107,7 +107,7 @@ module GraphQL
107
107
  def get_field(parent_type, field_name); @schema.get_field(parent_type, field_name); end
108
108
  def reachable_type?(type_name); true; end
109
109
  def loadable?(type, _ctx); true; end
110
- def loadable_possible_types(union_type, _ctx); union_type.possible_types; end
110
+ def loadable_possible_types(abstract_type, _ctx); union_type.possible_types; end
111
111
  def reachable_types; @schema.types.values; end # rubocop:disable Development/ContextIsPassedCop
112
112
  def possible_types(type_defn); @schema.possible_types(type_defn, Query::NullContext.instance, false); end
113
113
  def interfaces(obj_type); obj_type.interfaces; end
@@ -237,11 +237,17 @@ module GraphQL
237
237
  (type.respond_to?(:interfaces) ? interfaces(type).all? { |i| loadable?(i, _ctx) } : true)
238
238
  end
239
239
 
240
- def loadable_possible_types(union_type, _ctx)
240
+ # This abstract type was determined to be used for `loads` only.
241
+ # All its possible types are valid possibilities here -- no filtering.
242
+ def loadable_possible_types(abstract_type, _ctx)
241
243
  @loadable_possible_types ||= read_through do |t|
242
- t.possible_types # unfiltered
244
+ if t.is_a?(Class) # union
245
+ t.possible_types
246
+ else
247
+ @schema.possible_types(abstract_type)
248
+ end
243
249
  end
244
- @loadable_possible_types[union_type]
250
+ @loadable_possible_types[abstract_type]
245
251
  end
246
252
 
247
253
  # @return [GraphQL::BaseType, nil] The type named `type_name`, if it exists (else `nil`)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.5.8"
3
+ VERSION = "2.5.9"
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.8
4
+ version: 2.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-28 00:00:00.000000000 Z
10
+ date: 2025-06-06 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: base64