graphql 2.3.4 → 2.3.5

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: c8f2d38dd0c349521f7f22050bb70cee1f06a7832de74d5afe523a35310ed318
4
- data.tar.gz: da047a5e11a1441060411c47468daad16300db1dc7064ab1b1a76d2e519e76fd
3
+ metadata.gz: e5f20ae656aec8f5ad77a6edd73103d2f5a25511ae3c9b515c5b0c58ecc91cac
4
+ data.tar.gz: 6b51f66b0f2188c292b34c61e367de84cb37a7894e536b5b8105a95ec60b9c64
5
5
  SHA512:
6
- metadata.gz: 73bd380530a4183241587083beb2ef6c96709657fb18e702a294a37c22f26e2141b2111b96c79570b9588d330e9c8d851fd532cdaf6d6fbd55f9dd5b30c6fe4e
7
- data.tar.gz: 917e88d0cec3cbc760ec89714cf31325088f94f0a93094b3fcbf1cc3c07f52a99e30f0e418e561518c0a7deef0358dfa0ae457b8bad88fb50883aacb9d7dae7f
6
+ metadata.gz: 96bd289b9d880438ed2c7610b3a7008cb793fd4551191fcf084c0f947c3da195e07f07346e0b2c9b88177fdbeed098591508879756d7f5919c53c9576f5548e8
7
+ data.tar.gz: ce92d82eee23a710b66f3d29bdc29690b2e368f42ddfd60b159708dac0b018024a87bbf6069d8274878e98e0821f223b0cd2fafba41c23afab86dc7faa97328c
@@ -9,7 +9,7 @@ module Graphql
9
9
  class MutationRootGenerator < Rails::Generators::Base
10
10
  include Core
11
11
 
12
- desc "Create mutation base type, mutation root tipe, and adds the latter to the schema"
12
+ desc "Create mutation base type, mutation root type, and adds the latter to the schema"
13
13
  source_root File.expand_path('../templates', __FILE__)
14
14
 
15
15
  class_option :schema,
@@ -31,4 +31,4 @@ module Graphql
31
31
  end
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -12,7 +12,7 @@ module GraphQL
12
12
  @complexities_on_type_by_query = {}
13
13
  end
14
14
 
15
- # Overide this method to use the complexity result
15
+ # Override this method to use the complexity result
16
16
  def result
17
17
  max_possible_complexity
18
18
  end
@@ -8,7 +8,7 @@ module GraphQL
8
8
  # simple internal code while adding the option to add Dataloader.
9
9
  class NullDataloader < Dataloader
10
10
  # These are all no-ops because code was
11
- # executed sychronously.
11
+ # executed synchronously.
12
12
  def run; end
13
13
  def run_isolated; yield; end
14
14
  def yield
@@ -5,7 +5,7 @@ module GraphQL
5
5
  class Interpreter
6
6
  class Runtime
7
7
  module GraphQLResult
8
- def initialize(result_name, result_type, application_value, parent_result, is_non_null_in_parent)
8
+ def initialize(result_name, result_type, application_value, parent_result, is_non_null_in_parent, selections, is_eager)
9
9
  @graphql_parent = parent_result
10
10
  @graphql_application_value = application_value
11
11
  @graphql_result_type = result_type
@@ -16,6 +16,8 @@ module GraphQL
16
16
  @graphql_is_non_null_in_parent = is_non_null_in_parent
17
17
  # Jump through some hoops to avoid creating this duplicate storage if at all possible.
18
18
  @graphql_metadata = nil
19
+ @graphql_selections = selections
20
+ @graphql_is_eager = is_eager
19
21
  end
20
22
 
21
23
  def path
@@ -28,14 +30,15 @@ module GraphQL
28
30
  end
29
31
 
30
32
  attr_accessor :graphql_dead
31
- attr_reader :graphql_parent, :graphql_result_name, :graphql_is_non_null_in_parent, :graphql_application_value, :graphql_result_type
33
+ attr_reader :graphql_parent, :graphql_result_name, :graphql_is_non_null_in_parent,
34
+ :graphql_application_value, :graphql_result_type, :graphql_selections, :graphql_is_eager
32
35
 
33
36
  # @return [Hash] Plain-Ruby result data (`@graphql_metadata` contains Result wrapper objects)
34
37
  attr_accessor :graphql_result_data
35
38
  end
36
39
 
37
40
  class GraphQLResultHash
38
- def initialize(_result_name, _result_type, _application_value, _parent_result, _is_non_null_in_parent)
41
+ def initialize(_result_name, _result_type, _application_value, _parent_result, _is_non_null_in_parent, _selections, _is_eager)
39
42
  super
40
43
  @graphql_result_data = {}
41
44
  end
@@ -123,7 +126,7 @@ module GraphQL
123
126
  class GraphQLResultArray
124
127
  include GraphQLResult
125
128
 
126
- def initialize(_result_name, _result_type, _application_value, _parent_result, _is_non_null_in_parent)
129
+ def initialize(_result_name, _result_type, _application_value, _parent_result, _is_non_null_in_parent, _selections, _is_eager)
127
130
  super
128
131
  @graphql_result_data = []
129
132
  end
@@ -65,16 +65,6 @@ module GraphQL
65
65
  "#<#{self.class.name} response=#{@response.inspect}>"
66
66
  end
67
67
 
68
- def tap_or_each(obj_or_array)
69
- if obj_or_array.is_a?(Array)
70
- obj_or_array.each do |item|
71
- yield(item, true)
72
- end
73
- else
74
- yield(obj_or_array, false)
75
- end
76
- end
77
-
78
68
  # This _begins_ the execution. Some deferred work
79
69
  # might be stored up in lazies.
80
70
  # @return [void]
@@ -84,7 +74,8 @@ module GraphQL
84
74
  root_type = schema.root_type_for_operation(root_op_type)
85
75
  runtime_object = root_type.wrap(query.root_value, context)
86
76
  runtime_object = schema.sync_lazy(runtime_object)
87
- @response = GraphQLResultHash.new(nil, root_type, runtime_object, nil, false)
77
+ is_eager = root_op_type == "mutation"
78
+ @response = GraphQLResultHash.new(nil, root_type, runtime_object, nil, false, root_operation.selections, is_eager)
88
79
  st = get_current_runtime_state
89
80
  st.current_result = @response
90
81
 
@@ -93,17 +84,9 @@ module GraphQL
93
84
  @response = nil
94
85
  else
95
86
  call_method_on_directives(:resolve, runtime_object, root_operation.directives) do # execute query level directives
96
- gathered_selections = gather_selections(runtime_object, root_type, root_operation.selections)
97
- # This is kind of a hack -- `gathered_selections` is an Array if any of the selections
98
- # require isolation during execution (because of runtime directives). In that case,
99
- # make a new, isolated result hash for writing the result into. (That isolated response
100
- # is eventually merged back into the main response)
101
- #
102
- # Otherwise, `gathered_selections` is a hash of selections which can be
103
- # directly evaluated and the results can be written right into the main response hash.
104
- tap_or_each(gathered_selections) do |selections, is_selection_array|
87
+ each_gathered_selections(@response) do |selections, is_selection_array|
105
88
  if is_selection_array
106
- selection_response = GraphQLResultHash.new(nil, root_type, runtime_object, nil, false)
89
+ selection_response = GraphQLResultHash.new(nil, root_type, runtime_object, nil, false, selections, is_eager)
107
90
  final_response = @response
108
91
  else
109
92
  selection_response = @response
@@ -112,12 +95,10 @@ module GraphQL
112
95
 
113
96
  @dataloader.append_job {
114
97
  evaluate_selections(
115
- root_op_type == "mutation",
116
98
  selections,
117
99
  selection_response,
118
100
  final_response,
119
101
  nil,
120
- nil,
121
102
  )
122
103
  }
123
104
  end
@@ -126,6 +107,17 @@ module GraphQL
126
107
  nil
127
108
  end
128
109
 
110
+ def each_gathered_selections(response_hash)
111
+ gathered_selections = gather_selections(response_hash.graphql_application_value, response_hash.graphql_result_type, response_hash.graphql_selections)
112
+ if gathered_selections.is_a?(Array)
113
+ gathered_selections.each do |item|
114
+ yield(item, true)
115
+ end
116
+ else
117
+ yield(gathered_selections, false)
118
+ end
119
+ end
120
+
129
121
  def gather_selections(owner_object, owner_type, selections, selections_to_run = nil, selections_by_name = {})
130
122
  selections.each do |node|
131
123
  # Skip gathering this if the directive says so
@@ -138,7 +130,7 @@ module GraphQL
138
130
  selections = selections_by_name[response_key]
139
131
  # if there was already a selection of this field,
140
132
  # use an array to hold all selections,
141
- # otherise, use the single node to represent the selection
133
+ # otherwise, use the single node to represent the selection
142
134
  if selections
143
135
  # This field was already selected at least once,
144
136
  # add this node to the list of selections
@@ -203,7 +195,7 @@ module GraphQL
203
195
  NO_ARGS = GraphQL::EmptyObjects::EMPTY_HASH
204
196
 
205
197
  # @return [void]
206
- def evaluate_selections(is_eager_selection, gathered_selections, selections_result, target_result, parent_object, runtime_state) # rubocop:disable Metrics/ParameterLists
198
+ def evaluate_selections(gathered_selections, selections_result, target_result, runtime_state) # rubocop:disable Metrics/ParameterLists
207
199
  runtime_state ||= get_current_runtime_state
208
200
  runtime_state.current_result_name = nil
209
201
  runtime_state.current_result = selections_result
@@ -218,7 +210,7 @@ module GraphQL
218
210
  gathered_selections.each do |result_name, field_ast_nodes_or_ast_node|
219
211
  @dataloader.append_job {
220
212
  evaluate_selection(
221
- result_name, field_ast_nodes_or_ast_node, is_eager_selection, selections_result, parent_object
213
+ result_name, field_ast_nodes_or_ast_node, selections_result
222
214
  )
223
215
  finished_jobs += 1
224
216
  if target_result && finished_jobs == enqueued_jobs
@@ -228,7 +220,7 @@ module GraphQL
228
220
  # Field resolution may pause the fiber,
229
221
  # so it wouldn't get to the `Resolve` call that happens below.
230
222
  # So instead trigger a run from this outer context.
231
- if is_eager_selection
223
+ if selections_result.graphql_is_eager
232
224
  @dataloader.clear_cache
233
225
  @dataloader.run
234
226
  @dataloader.clear_cache
@@ -239,7 +231,7 @@ module GraphQL
239
231
  end
240
232
 
241
233
  # @return [void]
242
- def evaluate_selection(result_name, field_ast_nodes_or_ast_node, is_eager_field, selections_result, parent_object) # rubocop:disable Metrics/ParameterLists
234
+ def evaluate_selection(result_name, field_ast_nodes_or_ast_node, selections_result) # rubocop:disable Metrics/ParameterLists
243
235
  return if selections_result.graphql_dead
244
236
  # As a performance optimization, the hash key will be a `Node` if
245
237
  # there's only one selection of the field. But if there are multiple
@@ -266,28 +258,27 @@ module GraphQL
266
258
  owner_object = field_defn.owner.wrap(owner_object, context)
267
259
  end
268
260
 
269
- return_type = field_defn.type
270
261
  if !field_defn.any_arguments?
271
262
  resolved_arguments = GraphQL::Execution::Interpreter::Arguments::EMPTY
272
263
  if field_defn.extras.size == 0
273
264
  evaluate_selection_with_resolved_keyword_args(
274
- NO_ARGS, resolved_arguments, field_defn, ast_node, field_ast_nodes, owner_object, is_eager_field, result_name, selections_result, parent_object, return_type, return_type.non_null?, runtime_state
265
+ NO_ARGS, resolved_arguments, field_defn, ast_node, field_ast_nodes, owner_object, result_name, selections_result, runtime_state
275
266
  )
276
267
  else
277
- evaluate_selection_with_args(resolved_arguments, field_defn, ast_node, field_ast_nodes, owner_object, is_eager_field, result_name, selections_result, parent_object, return_type, runtime_state)
268
+ evaluate_selection_with_args(resolved_arguments, field_defn, ast_node, field_ast_nodes, owner_object, result_name, selections_result, runtime_state)
278
269
  end
279
270
  else
280
271
  @query.arguments_cache.dataload_for(ast_node, field_defn, owner_object) do |resolved_arguments|
281
272
  runtime_state = get_current_runtime_state # This might be in a different fiber
282
- evaluate_selection_with_args(resolved_arguments, field_defn, ast_node, field_ast_nodes, owner_object, is_eager_field, result_name, selections_result, parent_object, return_type, runtime_state)
273
+ evaluate_selection_with_args(resolved_arguments, field_defn, ast_node, field_ast_nodes, owner_object, result_name, selections_result, runtime_state)
283
274
  end
284
275
  end
285
276
  end
286
277
 
287
- def evaluate_selection_with_args(arguments, field_defn, ast_node, field_ast_nodes, object, is_eager_field, result_name, selection_result, parent_object, return_type, runtime_state) # rubocop:disable Metrics/ParameterLists
278
+ def evaluate_selection_with_args(arguments, field_defn, ast_node, field_ast_nodes, object, result_name, selection_result, runtime_state) # rubocop:disable Metrics/ParameterLists
288
279
  after_lazy(arguments, field: field_defn, ast_node: ast_node, owner_object: object, arguments: arguments, result_name: result_name, result: selection_result, runtime_state: runtime_state) do |resolved_arguments, runtime_state|
289
- return_type_non_null = return_type.non_null?
290
280
  if resolved_arguments.is_a?(GraphQL::ExecutionError) || resolved_arguments.is_a?(GraphQL::UnauthorizedError)
281
+ return_type_non_null = field_defn.type.non_null?
291
282
  continue_value(resolved_arguments, field_defn, return_type_non_null, ast_node, result_name, selection_result)
292
283
  next
293
284
  end
@@ -326,7 +317,8 @@ module GraphQL
326
317
  # to the keyword args hash _before_ freezing everything.
327
318
  extra_args[:argument_details] = :__arguments_add_self
328
319
  when :parent
329
- extra_args[:parent] = parent_object
320
+ parent_result = selection_result.graphql_parent
321
+ extra_args[:parent] = parent_result&.graphql_application_value&.object
330
322
  else
331
323
  extra_args[extra] = field_defn.fetch_extra(extra, context)
332
324
  end
@@ -337,11 +329,11 @@ module GraphQL
337
329
  resolved_arguments.keyword_arguments
338
330
  end
339
331
 
340
- evaluate_selection_with_resolved_keyword_args(kwarg_arguments, resolved_arguments, field_defn, ast_node, field_ast_nodes, object, is_eager_field, result_name, selection_result, parent_object, return_type, return_type_non_null, runtime_state)
332
+ evaluate_selection_with_resolved_keyword_args(kwarg_arguments, resolved_arguments, field_defn, ast_node, field_ast_nodes, object, result_name, selection_result, runtime_state)
341
333
  end
342
334
  end
343
335
 
344
- def evaluate_selection_with_resolved_keyword_args(kwarg_arguments, resolved_arguments, field_defn, ast_node, field_ast_nodes, object, is_eager_field, result_name, selection_result, parent_object, return_type, return_type_non_null, runtime_state) # rubocop:disable Metrics/ParameterLists
336
+ def evaluate_selection_with_resolved_keyword_args(kwarg_arguments, resolved_arguments, field_defn, ast_node, field_ast_nodes, object, result_name, selection_result, runtime_state) # rubocop:disable Metrics/ParameterLists
345
337
  runtime_state.current_field = field_defn
346
338
  runtime_state.current_arguments = resolved_arguments
347
339
  runtime_state.current_result_name = result_name
@@ -384,7 +376,8 @@ module GraphQL
384
376
  end
385
377
  after_lazy(app_result, field: field_defn, ast_node: ast_node, owner_object: object, arguments: resolved_arguments, result_name: result_name, result: selection_result, runtime_state: runtime_state) do |inner_result, runtime_state|
386
378
  owner_type = selection_result.graphql_result_type
387
- continue_value = continue_value(inner_result, field_defn, return_type_non_null, ast_node, result_name, selection_result)
379
+ return_type = field_defn.type
380
+ continue_value = continue_value(inner_result, field_defn, return_type.non_null?, ast_node, result_name, selection_result)
388
381
  if HALT != continue_value
389
382
  was_scoped = runtime_state.was_authorized_by_scope_items
390
383
  runtime_state.was_authorized_by_scope_items = nil
@@ -395,7 +388,7 @@ module GraphQL
395
388
  # If this field is a root mutation field, immediately resolve
396
389
  # all of its child fields before moving on to the next root mutation field.
397
390
  # (Subselections of this mutation will still be resolved level-by-level.)
398
- if is_eager_field
391
+ if selection_result.graphql_is_eager
399
392
  Interpreter::Resolve.resolve_all([field_result], @dataloader)
400
393
  end
401
394
  end
@@ -607,21 +600,11 @@ module GraphQL
607
600
  after_lazy(object_proxy, ast_node: ast_node, field: field, owner_object: owner_object, arguments: arguments, trace: false, result_name: result_name, result: selection_result, runtime_state: runtime_state) do |inner_object, runtime_state|
608
601
  continue_value = continue_value(inner_object, field, is_non_null, ast_node, result_name, selection_result)
609
602
  if HALT != continue_value
610
- response_hash = GraphQLResultHash.new(result_name, current_type, continue_value, selection_result, is_non_null)
603
+ response_hash = GraphQLResultHash.new(result_name, current_type, continue_value, selection_result, is_non_null, next_selections, false)
611
604
  set_result(selection_result, result_name, response_hash, true, is_non_null)
612
-
613
- gathered_selections = gather_selections(continue_value, current_type, next_selections)
614
- # There are two possibilities for `gathered_selections`:
615
- # 1. All selections of this object should be evaluated together (there are no runtime directives modifying execution).
616
- # This case is handled below, and the result can be written right into the main `response_hash` above.
617
- # In this case, `gathered_selections` is a hash of selections.
618
- # 2. Some selections of this object have runtime directives that may or may not modify execution.
619
- # That part of the selection is evaluated in an isolated way, writing into a sub-response object which is
620
- # eventually merged into the final response. In this case, `gathered_selections` is an array of things to run in isolation.
621
- # (Technically, it's possible that one of those entries _doesn't_ require isolation.)
622
- tap_or_each(gathered_selections) do |selections, is_selection_array|
605
+ each_gathered_selections(response_hash) do |selections, is_selection_array|
623
606
  if is_selection_array
624
- this_result = GraphQLResultHash.new(result_name, current_type, continue_value, selection_result, is_non_null)
607
+ this_result = GraphQLResultHash.new(result_name, current_type, continue_value, selection_result, is_non_null, selections, false)
625
608
  final_result = response_hash
626
609
  else
627
610
  this_result = response_hash
@@ -629,11 +612,9 @@ module GraphQL
629
612
  end
630
613
 
631
614
  evaluate_selections(
632
- false,
633
615
  selections,
634
616
  this_result,
635
617
  final_result,
636
- owner_object.object,
637
618
  runtime_state,
638
619
  )
639
620
  end
@@ -644,7 +625,7 @@ module GraphQL
644
625
  # This is true for objects, unions, and interfaces
645
626
  use_dataloader_job = !inner_type.unwrap.kind.input?
646
627
  inner_type_non_null = inner_type.non_null?
647
- response_list = GraphQLResultArray.new(result_name, current_type, response_list, selection_result, is_non_null)
628
+ response_list = GraphQLResultArray.new(result_name, current_type, owner_object, selection_result, is_non_null, next_selections, false)
648
629
  set_result(selection_result, result_name, response_list, true, is_non_null)
649
630
  idx = nil
650
631
  list_value = begin
@@ -654,10 +635,10 @@ module GraphQL
654
635
  idx += 1
655
636
  if use_dataloader_job
656
637
  @dataloader.append_job do
657
- resolve_list_item(inner_value, inner_type, inner_type_non_null, ast_node, field, owner_object, arguments, this_idx, response_list, next_selections, owner_type, was_scoped, runtime_state)
638
+ resolve_list_item(inner_value, inner_type, inner_type_non_null, ast_node, field, owner_object, arguments, this_idx, response_list, owner_type, was_scoped, runtime_state)
658
639
  end
659
640
  else
660
- resolve_list_item(inner_value, inner_type, inner_type_non_null, ast_node, field, owner_object, arguments, this_idx, response_list, next_selections, owner_type, was_scoped, runtime_state)
641
+ resolve_list_item(inner_value, inner_type, inner_type_non_null, ast_node, field, owner_object, arguments, this_idx, response_list, owner_type, was_scoped, runtime_state)
661
642
  end
662
643
  end
663
644
 
@@ -688,7 +669,7 @@ module GraphQL
688
669
  end
689
670
  end
690
671
 
691
- def resolve_list_item(inner_value, inner_type, inner_type_non_null, ast_node, field, owner_object, arguments, this_idx, response_list, next_selections, owner_type, was_scoped, runtime_state) # rubocop:disable Metrics/ParameterLists
672
+ def resolve_list_item(inner_value, inner_type, inner_type_non_null, ast_node, field, owner_object, arguments, this_idx, response_list, owner_type, was_scoped, runtime_state) # rubocop:disable Metrics/ParameterLists
692
673
  runtime_state.current_result_name = this_idx
693
674
  runtime_state.current_result = response_list
694
675
  call_method_on_directives(:resolve_each, owner_object, ast_node.directives) do
@@ -696,7 +677,7 @@ module GraphQL
696
677
  after_lazy(inner_value, ast_node: ast_node, field: field, owner_object: owner_object, arguments: arguments, result_name: this_idx, result: response_list, runtime_state: runtime_state) do |inner_inner_value, runtime_state|
697
678
  continue_value = continue_value(inner_inner_value, field, inner_type_non_null, ast_node, this_idx, response_list)
698
679
  if HALT != continue_value
699
- continue_field(continue_value, owner_type, field, inner_type, ast_node, next_selections, false, owner_object, arguments, this_idx, response_list, was_scoped, runtime_state)
680
+ continue_field(continue_value, owner_type, field, inner_type, ast_node, response_list.graphql_selections, false, owner_object, arguments, this_idx, response_list, was_scoped, runtime_state)
700
681
  end
701
682
  end
702
683
  end
@@ -20,7 +20,7 @@ module GraphQL
20
20
  # @param queries [Array<GraphQL::Query, Hash>]
21
21
  # @param context [Hash]
22
22
  # @param max_complexity [Integer, nil]
23
- # @return [Array<Hash>] One result per query
23
+ # @return [Array<GraphQL::Query::Result>] One result per query
24
24
  def run_all(schema, query_options, context: {}, max_complexity: schema.max_complexity)
25
25
  queries = query_options.map do |opts|
26
26
  case opts
@@ -274,6 +274,8 @@ module GraphQL
274
274
  ]
275
275
 
276
276
  def generate_initialize
277
+ return if method_defined?(:marshal_load, false) # checking for `:initialize` doesn't work right
278
+
277
279
  scalar_method_names = @scalar_methods
278
280
  # TODO: These probably should be scalar methods, but `types` returns an array
279
281
  [:types, :description].each do |extra_method|
@@ -392,16 +394,6 @@ module GraphQL
392
394
 
393
395
  # A single selection in a GraphQL query.
394
396
  class Field < AbstractNode
395
- scalar_methods :name, :alias
396
- children_methods({
397
- arguments: GraphQL::Language::Nodes::Argument,
398
- selections: GraphQL::Language::Nodes::Field,
399
- directives: GraphQL::Language::Nodes::Directive,
400
- })
401
-
402
- # @!attribute selections
403
- # @return [Array<Nodes::Field>] Selections on this object (or empty array if this is a scalar field)
404
-
405
397
  def initialize(name: nil, arguments: NONE, directives: NONE, selections: NONE, field_alias: nil, line: nil, col: nil, pos: nil, filename: nil, source: nil)
406
398
  @name = name
407
399
  @arguments = arguments || NONE
@@ -428,24 +420,19 @@ module GraphQL
428
420
  @line, @col, @filename, @name, @arguments, @directives, @selections, @alias = values
429
421
  end
430
422
 
431
- # Override this because default is `:fields`
432
- self.children_method_name = :selections
433
- end
434
-
435
- # A reusable fragment, defined at document-level.
436
- class FragmentDefinition < AbstractNode
437
- scalar_methods :name, :type
423
+ scalar_methods :name, :alias
438
424
  children_methods({
425
+ arguments: GraphQL::Language::Nodes::Argument,
439
426
  selections: GraphQL::Language::Nodes::Field,
440
427
  directives: GraphQL::Language::Nodes::Directive,
441
428
  })
442
429
 
443
- self.children_method_name = :definitions
444
- # @!attribute name
445
- # @return [String] the identifier for this fragment, which may be applied with `...#{name}`
430
+ # Override this because default is `:fields`
431
+ self.children_method_name = :selections
432
+ end
446
433
 
447
- # @!attribute type
448
- # @return [String] the type condition for this fragment (name of type which it may apply to)
434
+ # A reusable fragment, defined at document-level.
435
+ class FragmentDefinition < AbstractNode
449
436
  def initialize(name: nil, type: nil, directives: NONE, selections: NONE, filename: nil, pos: nil, source: nil, line: nil, col: nil)
450
437
  @name = name
451
438
  @type = type
@@ -469,6 +456,14 @@ module GraphQL
469
456
  def marshal_load(values)
470
457
  @line, @col, @filename, @name, @type, @directives, @selections = values
471
458
  end
459
+
460
+ scalar_methods :name, :type
461
+ children_methods({
462
+ selections: GraphQL::Language::Nodes::Field,
463
+ directives: GraphQL::Language::Nodes::Directive,
464
+ })
465
+
466
+ self.children_method_name = :definitions
472
467
  end
473
468
 
474
469
  # Application of a named fragment in a selection
@@ -379,7 +379,12 @@ module GraphQL
379
379
  v_loc = pos
380
380
  description = if at?(:STRING); string_value; end
381
381
  defn_loc = pos
382
- enum_value = parse_enum_name
382
+ # Any identifier, but not true, false, or null
383
+ enum_value = if at?(:TRUE) || at?(:FALSE) || at?(:NULL)
384
+ expect_token(:IDENTIFIER)
385
+ else
386
+ parse_name
387
+ end
383
388
  v_directives = parse_directives
384
389
  list << EnumValueDefinition.new(pos: v_loc, definition_pos: defn_loc, description: description, name: enum_value, directives: v_directives, filename: @filename, source: self)
385
390
  end
@@ -615,9 +620,6 @@ module GraphQL
615
620
  when :ON
616
621
  advance_token
617
622
  "on"
618
- when :DIRECTIVE
619
- advance_token
620
- "directive"
621
623
  when :EXTEND
622
624
  advance_token
623
625
  "extend"
@@ -634,15 +636,6 @@ module GraphQL
634
636
  end
635
637
  end
636
638
 
637
- # Any identifier, but not true, false, or null
638
- def parse_enum_name
639
- if at?(:TRUE) || at?(:FALSE) || at?(:NULL)
640
- expect_token(:IDENTIFIER)
641
- else
642
- parse_name
643
- end
644
- end
645
-
646
639
  def parse_type_name
647
640
  TypeName.new(pos: pos, name: parse_name, filename: @filename, source: self)
648
641
  end
@@ -733,6 +726,54 @@ module GraphQL
733
726
  loc = pos
734
727
  advance_token
735
728
  VariableIdentifier.new(pos: loc, name: parse_name, filename: @filename, source: self)
729
+ when :SCHEMA
730
+ advance_token
731
+ Nodes::Enum.new(pos: pos, name: "schema", filename: @filename, source: self)
732
+ when :SCALAR
733
+ advance_token
734
+ Nodes::Enum.new(pos: pos, name: "scalar", filename: @filename, source: self)
735
+ when :IMPLEMENTS
736
+ advance_token
737
+ Nodes::Enum.new(pos: pos, name: "implements", filename: @filename, source: self)
738
+ when :INTERFACE
739
+ advance_token
740
+ Nodes::Enum.new(pos: pos, name: "interface", filename: @filename, source: self)
741
+ when :UNION
742
+ advance_token
743
+ Nodes::Enum.new(pos: pos, name: "union", filename: @filename, source: self)
744
+ when :ENUM
745
+ advance_token
746
+ Nodes::Enum.new(pos: pos, name: "enum", filename: @filename, source: self)
747
+ when :INPUT
748
+ advance_token
749
+ Nodes::Enum.new(pos: pos, name: "input", filename: @filename, source: self)
750
+ when :DIRECTIVE
751
+ advance_token
752
+ Nodes::Enum.new(pos: pos, name: "directive", filename: @filename, source: self)
753
+ when :TYPE
754
+ advance_token
755
+ Nodes::Enum.new(pos: pos, name: "type", filename: @filename, source: self)
756
+ when :QUERY
757
+ advance_token
758
+ Nodes::Enum.new(pos: pos, name: "query", filename: @filename, source: self)
759
+ when :MUTATION
760
+ advance_token
761
+ Nodes::Enum.new(pos: pos, name: "mutation", filename: @filename, source: self)
762
+ when :SUBSCRIPTION
763
+ advance_token
764
+ Nodes::Enum.new(pos: pos, name: "subscription", filename: @filename, source: self)
765
+ when :FRAGMENT
766
+ advance_token
767
+ Nodes::Enum.new(pos: pos, name: "fragment", filename: @filename, source: self)
768
+ when :REPEATABLE
769
+ advance_token
770
+ Nodes::Enum.new(pos: pos, name: "repeatable", filename: @filename, source: self)
771
+ when :ON
772
+ advance_token
773
+ Nodes::Enum.new(pos: pos, name: "on", filename: @filename, source: self)
774
+ when :EXTEND
775
+ advance_token
776
+ Nodes::Enum.new(pos: pos, name: "extend", filename: @filename, source: self)
736
777
  else
737
778
  expect_token(:VALUE)
738
779
  end
data/lib/graphql/query.rb CHANGED
@@ -222,7 +222,7 @@ module GraphQL
222
222
  end
223
223
 
224
224
  # Get the result for this query, executing it once
225
- # @return [Hash] A GraphQL response, with `"data"` and/or `"errors"` keys
225
+ # @return [GraphQL::Query::Result] A Hash-like GraphQL response, with `"data"` and/or `"errors"` keys
226
226
  def result
227
227
  if !@executed
228
228
  Execution::Interpreter.run_all(@schema, [self], context: @context)
@@ -9,7 +9,7 @@ module GraphQL
9
9
 
10
10
  # Return the source of `send_node`, but without the keyword argument represented by `pair_node`
11
11
  def source_without_keyword_argument(send_node, pair_node)
12
- # work back to the preceeding comma
12
+ # work back to the preceding comma
13
13
  first_pos = pair_node.location.expression.begin_pos
14
14
  end_pos = pair_node.location.expression.end_pos
15
15
  node_source = send_node.source_range.source
@@ -12,7 +12,7 @@ module GraphQL
12
12
  @possible_types = {}
13
13
  @types = {}
14
14
  @union_memberships = {}
15
- @references = Hash.new { |h, k| h[k] = [] }
15
+ @references = Hash.new { |h, k| h[k] = Set.new }
16
16
  @arguments_with_default_values = []
17
17
  add_type_and_traverse(new_types)
18
18
  end
@@ -20,7 +20,7 @@ module GraphQL
20
20
  private
21
21
 
22
22
  def references_to(thing, from:)
23
- @references[thing] << from
23
+ @references[thing].add(from)
24
24
  end
25
25
 
26
26
  def get_type(name)
@@ -95,7 +95,7 @@ module GraphQL
95
95
  # It's a union with possible_types
96
96
  # Replace the item by class name
97
97
  owner.assign_type_membership_object_type(type)
98
- @possible_types[owner.graphql_name] = owner.possible_types
98
+ @possible_types[owner] = owner.possible_types
99
99
  elsif type.kind.interface? && (owner.kind.object? || owner.kind.interface?)
100
100
  new_interfaces = []
101
101
  owner.interfaces.each do |int_t|
@@ -110,7 +110,7 @@ module GraphQL
110
110
  end
111
111
  owner.implements(*new_interfaces)
112
112
  new_interfaces.each do |int|
113
- pt = @possible_types[int.graphql_name] ||= []
113
+ pt = @possible_types[int] ||= []
114
114
  if !pt.include?(owner) && owner.is_a?(Class)
115
115
  pt << owner
116
116
  end
@@ -126,6 +126,7 @@ module GraphQL
126
126
  @types[type.graphql_name] = type
127
127
  when GraphQL::Schema::Field, GraphQL::Schema::Argument
128
128
  orig_type = owner.type
129
+ unwrapped_t = type
129
130
  # Apply list/non-null wrapper as needed
130
131
  if orig_type.respond_to?(:of_type)
131
132
  transforms = []
@@ -142,6 +143,7 @@ module GraphQL
142
143
  transforms.reverse_each { |t| type = type.public_send(t) }
143
144
  end
144
145
  owner.type = type
146
+ references_to(unwrapped_t, from: owner)
145
147
  else
146
148
  raise "Unexpected update: #{owner.inspect} #{type.inspect}"
147
149
  end
@@ -164,7 +166,9 @@ module GraphQL
164
166
  @directives << type
165
167
  type.all_argument_definitions.each do |arg|
166
168
  arg_type = arg.type.unwrap
167
- references_to(arg_type, from: arg)
169
+ if !arg_type.is_a?(GraphQL::Schema::LateBoundType)
170
+ references_to(arg_type, from: arg)
171
+ end
168
172
  path.push(arg.graphql_name)
169
173
  add_type(arg_type, owner: arg, late_types: late_types, path: path)
170
174
  path.pop
@@ -187,14 +191,18 @@ module GraphQL
187
191
  type.all_field_definitions.each do |field|
188
192
  name = field.graphql_name
189
193
  field_type = field.type.unwrap
190
- references_to(field_type, from: field)
194
+ if !field_type.is_a?(GraphQL::Schema::LateBoundType)
195
+ references_to(field_type, from: field)
196
+ end
191
197
  path.push(name)
192
198
  add_type(field_type, owner: field, late_types: late_types, path: path)
193
199
  add_directives_from(field)
194
200
  field.all_argument_definitions.each do |arg|
195
201
  add_directives_from(arg)
196
202
  arg_type = arg.type.unwrap
197
- references_to(arg_type, from: arg)
203
+ if !arg_type.is_a?(GraphQL::Schema::LateBoundType)
204
+ references_to(arg_type, from: arg)
205
+ end
198
206
  path.push(arg.graphql_name)
199
207
  add_type(arg_type, owner: arg, late_types: late_types, path: path)
200
208
  path.pop
@@ -209,7 +217,9 @@ module GraphQL
209
217
  type.all_argument_definitions.each do |arg|
210
218
  add_directives_from(arg)
211
219
  arg_type = arg.type.unwrap
212
- references_to(arg_type, from: arg)
220
+ if !arg_type.is_a?(GraphQL::Schema::LateBoundType)
221
+ references_to(arg_type, from: arg)
222
+ end
213
223
  path.push(arg.graphql_name)
214
224
  add_type(arg_type, owner: arg, late_types: late_types, path: path)
215
225
  path.pop
@@ -219,7 +229,7 @@ module GraphQL
219
229
  end
220
230
  end
221
231
  if type.kind.union?
222
- @possible_types[type.graphql_name] = type.all_possible_types
232
+ @possible_types[type] = type.all_possible_types
223
233
  path.push("possible_types")
224
234
  type.all_possible_types.each do |t|
225
235
  add_type(t, owner: type, late_types: late_types, path: path)
@@ -234,7 +244,7 @@ module GraphQL
234
244
  path.pop
235
245
  end
236
246
  if type.kind.object?
237
- possible_types_for_this_name = @possible_types[type.graphql_name] ||= []
247
+ possible_types_for_this_name = @possible_types[type] ||= []
238
248
  possible_types_for_this_name << type
239
249
  end
240
250
 
@@ -246,7 +256,7 @@ module GraphQL
246
256
  interface_type = interface_type_membership.abstract_type
247
257
  # We can get these now; we'll have to get late-bound types later
248
258
  if interface_type.is_a?(Module) && type.is_a?(Class)
249
- implementers = @possible_types[interface_type.graphql_name] ||= []
259
+ implementers = @possible_types[interface_type] ||= []
250
260
  implementers << type
251
261
  end
252
262
  when String, Schema::LateBoundType
@@ -47,6 +47,7 @@ module GraphQL
47
47
  def dummy
48
48
  @dummy ||= begin
49
49
  d = Class.new(GraphQL::Schema::Resolver)
50
+ d.graphql_name "#{self.graphql_name}DummyResolver"
50
51
  d.argument_class(self.argument_class)
51
52
  # TODO make this lazier?
52
53
  d.argument(:input, input_type, description: "Parameters for #{self.graphql_name}")
@@ -136,6 +136,7 @@ module GraphQL
136
136
  def #{method_name}
137
137
  self[#{method_name.inspect}]
138
138
  end
139
+ alias_method :#{method_name}, :#{method_name}
139
140
  RUBY
140
141
  argument_defn
141
142
  end
@@ -25,10 +25,10 @@ module GraphQL
25
25
  load_constant(:DirectiveLocationEnum)
26
26
  ]
27
27
  @types = {}
28
- @possible_types = {}
28
+ @possible_types = {}.tap(&:compare_by_identity)
29
29
  type_defns.each do |t|
30
30
  @types[t.graphql_name] = t
31
- @possible_types[t.graphql_name] = [t]
31
+ @possible_types[t] = [t]
32
32
  end
33
33
  @entry_point_fields =
34
34
  if schema.disable_introspection_entry_points?
@@ -25,6 +25,10 @@ module GraphQL
25
25
  @to_list_type ||= GraphQL::Schema::List.new(self)
26
26
  end
27
27
 
28
+ def to_type_signature
29
+ name
30
+ end
31
+
28
32
  def inspect
29
33
  "#<LateBoundType @name=#{name}>"
30
34
  end
@@ -52,7 +52,7 @@ module GraphQL
52
52
  unless item_result.valid?
53
53
  if max_errors
54
54
  if max_errors == 0
55
- add_max_errros_reached_message(result)
55
+ add_max_errors_reached_message(result)
56
56
  break
57
57
  end
58
58
 
@@ -76,7 +76,7 @@ module GraphQL
76
76
  end
77
77
  end
78
78
 
79
- def add_max_errros_reached_message(result)
79
+ def add_max_errors_reached_message(result)
80
80
  message = "Too many errors processing list variable, max validation error limit reached. Execution aborted"
81
81
  item_result = GraphQL::Query::InputValidationResult.from_problem(message)
82
82
  result.merge_result!(nil, item_result)
@@ -38,39 +38,6 @@ module GraphQL
38
38
  end
39
39
  arg_defn = self.argument_class.new(*args, **kwargs, &block)
40
40
  add_argument(arg_defn)
41
-
42
- if self.is_a?(Class) && !method_defined?(:"load_#{arg_defn.keyword}")
43
- method_owner = if self < GraphQL::Schema::InputObject || self < GraphQL::Schema::Directive
44
- "self."
45
- elsif self < GraphQL::Schema::Resolver
46
- ""
47
- else
48
- raise "Unexpected argument owner: #{self}"
49
- end
50
- if loads && arg_defn.type.list?
51
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
52
- def #{method_owner}load_#{arg_defn.keyword}(values, context = nil)
53
- argument = get_argument("#{arg_defn.graphql_name}", context || self.context)
54
- (context || self.context).query.after_lazy(values) do |values2|
55
- GraphQL::Execution::Lazy.all(values2.map { |value| load_application_object(argument, value, context || self.context) })
56
- end
57
- end
58
- RUBY
59
- elsif loads
60
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
61
- def #{method_owner}load_#{arg_defn.keyword}(value, context = nil)
62
- argument = get_argument("#{arg_defn.graphql_name}", context || self.context)
63
- load_application_object(argument, value, context || self.context)
64
- end
65
- RUBY
66
- else
67
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
68
- def #{method_owner}load_#{arg_defn.keyword}(value, _context = nil)
69
- value
70
- end
71
- RUBY
72
- end
73
- end
74
41
  arg_defn
75
42
  end
76
43
 
@@ -259,8 +226,8 @@ module GraphQL
259
226
  #
260
227
  # @param values [Hash<String, Object>]
261
228
  # @param context [GraphQL::Query::Context]
262
- # @yield [Interpreter::Arguments, Execution::Lazy<Interpeter::Arguments>]
263
- # @return [Interpreter::Arguments, Execution::Lazy<Interpeter::Arguments>]
229
+ # @yield [Interpreter::Arguments, Execution::Lazy<Interpreter::Arguments>]
230
+ # @return [Interpreter::Arguments, Execution::Lazy<Interpreter::Arguments>]
264
231
  def coerce_arguments(parent_object, values, context, &block)
265
232
  # Cache this hash to avoid re-merging it
266
233
  arg_defns = context.warden.arguments(self)
@@ -91,7 +91,7 @@ module GraphQL
91
91
  private
92
92
 
93
93
  # Modify `target` by adding items from `dirs` such that:
94
- # - Any name conflict is overriden by the incoming member of `dirs`
94
+ # - Any name conflict is overridden by the incoming member of `dirs`
95
95
  # - Any other member of `dirs` is appended
96
96
  # @param target [Array<GraphQL::Schema::Directive>]
97
97
  # @param dirs [Array<GraphQL::Schema::Directive>]
@@ -76,7 +76,7 @@ module GraphQL
76
76
 
77
77
  private
78
78
 
79
- # If one of thse values is accessed, initialize all the instance variables to retain
79
+ # If one of these values is accessed, initialize all the instance variables to retain
80
80
  # a consistent object shape.
81
81
  def initialize_relay_metadata
82
82
  if !defined?(@connection_type)
@@ -4,12 +4,11 @@ module GraphQL
4
4
  class Schema
5
5
  class Member
6
6
  module TypeSystemHelpers
7
- def initialize(*args, &block)
7
+ def initialize(...)
8
8
  super
9
9
  @to_non_null_type ||= nil
10
10
  @to_list_type ||= nil
11
11
  end
12
- ruby2_keywords :initialize if respond_to?(:ruby2_keywords, true)
13
12
 
14
13
  # @return [Schema::NonNull] Make a non-null-type representation of this type
15
14
  def to_non_null_type
@@ -295,7 +295,7 @@ module GraphQL
295
295
  true
296
296
  else
297
297
  if @context.respond_to?(:logger) && (logger = @context.logger)
298
- logger.debug { "Interface `#{type_defn.graphql_name}` hidden because it has no visible implementors" }
298
+ logger.debug { "Interface `#{type_defn.graphql_name}` hidden because it has no visible implementers" }
299
299
  end
300
300
  false
301
301
  end
@@ -363,8 +363,7 @@ module GraphQL
363
363
  end
364
364
 
365
365
  def referenced?(type_defn)
366
- graphql_name = type_defn.unwrap.graphql_name
367
- members = @schema.references_to(graphql_name)
366
+ members = @schema.references_to(type_defn)
368
367
  members.any? { |m| visible?(m) }
369
368
  end
370
369
 
@@ -187,7 +187,7 @@ module GraphQL
187
187
  # {default_trace_mode} is used when no `trace_mode: ...` is requested.
188
188
  #
189
189
  # When a `trace_class` is added this way, it will _not_ receive other modules added with `trace_with(...)`
190
- # unless `trace_mode` is explicitly given. (This class will not recieve any default trace modules.)
190
+ # unless `trace_mode` is explicitly given. (This class will not receive any default trace modules.)
191
191
  #
192
192
  # Subclasses of the schema will use `trace_class` as a base class for this mode and those
193
193
  # subclass also will _not_ receive default tracing modules.
@@ -506,7 +506,7 @@ module GraphQL
506
506
  if type.kind.union?
507
507
  type.possible_types(context: context)
508
508
  else
509
- stored_possible_types = own_possible_types[type.graphql_name]
509
+ stored_possible_types = own_possible_types[type]
510
510
  visible_possible_types = if stored_possible_types && type.kind.interface?
511
511
  stored_possible_types.select do |possible_type|
512
512
  possible_type.interfaces(context).include?(type)
@@ -515,7 +515,7 @@ module GraphQL
515
515
  stored_possible_types
516
516
  end
517
517
  visible_possible_types ||
518
- introspection_system.possible_types[type.graphql_name] ||
518
+ introspection_system.possible_types[type] ||
519
519
  (
520
520
  superclass.respond_to?(:possible_types) ?
521
521
  superclass.possible_types(type, context) :
@@ -553,14 +553,9 @@ module GraphQL
553
553
  attr_writer :dataloader_class
554
554
 
555
555
  def references_to(to_type = nil, from: nil)
556
- @own_references_to ||= {}
557
556
  if to_type
558
- if !to_type.is_a?(String)
559
- to_type = to_type.graphql_name
560
- end
561
-
562
557
  if from
563
- refs = @own_references_to[to_type] ||= []
558
+ refs = own_references_to[to_type] ||= []
564
559
  refs << from
565
560
  else
566
561
  get_references_to(to_type) || EMPTY_ARRAY
@@ -571,9 +566,9 @@ module GraphQL
571
566
  # So optimize the most common case -- don't create a duplicate Hash.
572
567
  inherited_value = find_inherited_value(:references_to, EMPTY_HASH)
573
568
  if inherited_value.any?
574
- inherited_value.merge(@own_references_to)
569
+ inherited_value.merge(own_references_to)
575
570
  else
576
- @own_references_to
571
+ own_references_to
577
572
  end
578
573
  end
579
574
  end
@@ -1287,7 +1282,7 @@ module GraphQL
1287
1282
 
1288
1283
  # Execute a query on itself.
1289
1284
  # @see {Query#initialize} for arguments.
1290
- # @return [Hash] query result, ready to be serialized as JSON
1285
+ # @return [GraphQL::Query::Result] query result, ready to be serialized as JSON
1291
1286
  def execute(query_str = nil, **kwargs)
1292
1287
  if query_str
1293
1288
  kwargs[:query] = query_str
@@ -1327,7 +1322,7 @@ module GraphQL
1327
1322
  # @see {Execution::Multiplex#run_all} for multiplex keyword arguments
1328
1323
  # @param queries [Array<Hash>] Keyword arguments for each query
1329
1324
  # @param context [Hash] Multiplex-level context
1330
- # @return [Array<Hash>] One result for each query in the input
1325
+ # @return [Array<GraphQL::Query::Result>] One result for each query in the input
1331
1326
  def multiplex(queries, **kwargs)
1332
1327
  GraphQL::Execution::Interpreter.run_all(self, queries, **kwargs)
1333
1328
  end
@@ -1460,7 +1455,8 @@ module GraphQL
1460
1455
  own_union_memberships.merge!(addition.union_memberships)
1461
1456
 
1462
1457
  addition.references.each { |thing, pointers|
1463
- pointers.each { |pointer| references_to(thing, from: pointer) }
1458
+ prev_refs = own_references_to[thing] || []
1459
+ own_references_to[thing] = prev_refs | pointers.to_a
1464
1460
  }
1465
1461
 
1466
1462
  addition.directives.each { |dir_class| own_directives[dir_class.graphql_name] = dir_class }
@@ -1488,6 +1484,10 @@ module GraphQL
1488
1484
  @own_types ||= {}
1489
1485
  end
1490
1486
 
1487
+ def own_references_to
1488
+ @own_references_to ||= {}.tap(&:compare_by_identity)
1489
+ end
1490
+
1491
1491
  def non_introspection_types
1492
1492
  find_inherited_value(:non_introspection_types, EMPTY_HASH).merge(own_types)
1493
1493
  end
@@ -1501,7 +1501,7 @@ module GraphQL
1501
1501
  end
1502
1502
 
1503
1503
  def own_possible_types
1504
- @own_possible_types ||= {}
1504
+ @own_possible_types ||= {}.tap(&:compare_by_identity)
1505
1505
  end
1506
1506
 
1507
1507
  def own_union_memberships
@@ -1529,15 +1529,15 @@ module GraphQL
1529
1529
  end
1530
1530
 
1531
1531
  # This is overridden in subclasses to check the inheritance chain
1532
- def get_references_to(type_name)
1533
- @own_references_to[type_name]
1532
+ def get_references_to(type_defn)
1533
+ own_references_to[type_defn]
1534
1534
  end
1535
1535
  end
1536
1536
 
1537
1537
  module SubclassGetReferencesTo
1538
- def get_references_to(type_name)
1539
- own_refs = @own_references_to[type_name]
1540
- inherited_refs = superclass.references_to(type_name)
1538
+ def get_references_to(type_defn)
1539
+ own_refs = own_references_to[type_defn]
1540
+ inherited_refs = superclass.references_to(type_defn)
1541
1541
  if inherited_refs&.any?
1542
1542
  if own_refs&.any?
1543
1543
  own_refs + inherited_refs
@@ -396,7 +396,7 @@ module GraphQL
396
396
  end
397
397
 
398
398
  # Given two list of parents, find out if they are mutually exclusive
399
- # In this context, `parents` represends the "self scope" of the field,
399
+ # In this context, `parents` represents the "self scope" of the field,
400
400
  # what types may be found at this point in the query.
401
401
  def mutually_exclusive?(parents1, parents2)
402
402
  if parents1.empty? || parents2.empty?
@@ -107,7 +107,7 @@ module GraphQL
107
107
  when 2
108
108
  true
109
109
  else
110
- raise ArgumentError, "#{@serializer} must repond to `.load` accepting one or two arguments"
110
+ raise ArgumentError, "#{@serializer} must respond to `.load` accepting one or two arguments"
111
111
  end
112
112
  @transmit_ns = namespace
113
113
  super
@@ -16,7 +16,7 @@ module GraphQL
16
16
  @description = description
17
17
  end
18
18
 
19
- # Does this TypeKind have multiple possible implementors?
19
+ # Does this TypeKind have multiple possible implementers?
20
20
  # @deprecated Use `abstract?` instead of `resolves?`.
21
21
  def resolves?; @abstract; end
22
22
  # Is this TypeKind abstract?
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.3.4"
3
+ VERSION = "2.3.5"
4
4
  end
data/lib/graphql.rb CHANGED
@@ -6,14 +6,6 @@ require "singleton"
6
6
  require "forwardable"
7
7
 
8
8
  module GraphQL
9
- # forwards-compat for argument handling
10
- module Ruby2Keywords
11
- if RUBY_VERSION < "2.7"
12
- def ruby2_keywords(*)
13
- end
14
- end
15
- end
16
-
17
9
  class Error < StandardError
18
10
  end
19
11
 
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: 2.3.4
4
+ version: 2.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-21 00:00:00.000000000 Z
11
+ date: 2024-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64