graphql 2.2.5 → 2.3.3
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.
Potentially problematic release.
This version of graphql might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/generators/graphql/templates/schema.erb +3 -0
- data/lib/graphql/analysis/ast/field_usage.rb +36 -9
- data/lib/graphql/analysis/ast/query_complexity.rb +3 -0
- data/lib/graphql/analysis/ast/visitor.rb +8 -0
- data/lib/graphql/analysis/ast.rb +10 -1
- data/lib/graphql/backtrace/inspect_result.rb +0 -12
- data/lib/graphql/coercion_error.rb +1 -9
- data/lib/graphql/dataloader/request.rb +5 -0
- data/lib/graphql/execution/interpreter/argument_value.rb +5 -1
- data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +6 -4
- data/lib/graphql/execution/interpreter/runtime.rb +93 -106
- data/lib/graphql/execution/interpreter.rb +90 -150
- data/lib/graphql/introspection/entry_points.rb +9 -3
- data/lib/graphql/introspection/schema_type.rb +3 -1
- data/lib/graphql/language/document_from_schema_definition.rb +2 -3
- data/lib/graphql/language/lexer.rb +48 -30
- data/lib/graphql/language/nodes.rb +11 -16
- data/lib/graphql/language/parser.rb +94 -45
- data/lib/graphql/language/printer.rb +4 -0
- data/lib/graphql/language.rb +60 -0
- data/lib/graphql/pagination/array_connection.rb +6 -6
- data/lib/graphql/query/context.rb +30 -33
- data/lib/graphql/query/validation_pipeline.rb +2 -2
- data/lib/graphql/query/variables.rb +3 -3
- data/lib/graphql/query.rb +3 -3
- data/lib/graphql/schema/argument.rb +18 -2
- data/lib/graphql/schema/base_64_encoder.rb +3 -5
- data/lib/graphql/schema/build_from_definition.rb +9 -1
- data/lib/graphql/schema/field.rb +33 -30
- data/lib/graphql/schema/input_object.rb +1 -2
- data/lib/graphql/schema/interface.rb +5 -1
- data/lib/graphql/schema/loader.rb +2 -1
- data/lib/graphql/schema/member/has_arguments.rb +2 -2
- data/lib/graphql/schema/mutation.rb +7 -0
- data/lib/graphql/schema/resolver.rb +19 -10
- data/lib/graphql/schema/unique_within_type.rb +1 -1
- data/lib/graphql/schema.rb +129 -29
- data/lib/graphql/static_validation/literal_validator.rb +1 -2
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +1 -1
- data/lib/graphql/static_validation/validator.rb +3 -0
- data/lib/graphql/subscriptions/serialize.rb +2 -0
- data/lib/graphql/subscriptions.rb +0 -3
- data/lib/graphql/testing/helpers.rb +32 -6
- data/lib/graphql/tracing/data_dog_trace.rb +21 -34
- data/lib/graphql/tracing/data_dog_tracing.rb +7 -21
- data/lib/graphql/tracing/legacy_hooks_trace.rb +74 -0
- data/lib/graphql/tracing/platform_tracing.rb +3 -1
- data/lib/graphql/tracing/{prometheus_tracing → prometheus_trace}/graphql_collector.rb +3 -1
- data/lib/graphql/tracing/prometheus_trace.rb +2 -2
- data/lib/graphql/tracing/sentry_trace.rb +112 -0
- data/lib/graphql/tracing.rb +3 -1
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +10 -2
- metadata +38 -23
- data/lib/graphql/schema/base_64_bp.rb +0 -26
- data/lib/graphql/subscriptions/instrumentation.rb +0 -28
@@ -11,7 +11,6 @@ module GraphQL
|
|
11
11
|
class Runtime
|
12
12
|
class CurrentState
|
13
13
|
def initialize
|
14
|
-
@current_object = nil
|
15
14
|
@current_field = nil
|
16
15
|
@current_arguments = nil
|
17
16
|
@current_result_name = nil
|
@@ -19,8 +18,12 @@ module GraphQL
|
|
19
18
|
@was_authorized_by_scope_items = nil
|
20
19
|
end
|
21
20
|
|
21
|
+
def current_object
|
22
|
+
@current_result.graphql_application_value
|
23
|
+
end
|
24
|
+
|
22
25
|
attr_accessor :current_result, :current_result_name,
|
23
|
-
:current_arguments, :current_field, :
|
26
|
+
:current_arguments, :current_field, :was_authorized_by_scope_items
|
24
27
|
end
|
25
28
|
|
26
29
|
# @return [GraphQL::Query]
|
@@ -39,7 +42,7 @@ module GraphQL
|
|
39
42
|
@lazies_at_depth = lazies_at_depth
|
40
43
|
@schema = query.schema
|
41
44
|
@context = query.context
|
42
|
-
@response =
|
45
|
+
@response = nil
|
43
46
|
# Identify runtime directives by checking which of this schema's directives have overridden `def self.resolve`
|
44
47
|
@runtime_directive_names = []
|
45
48
|
noop_resolve_owner = GraphQL::Schema::Directive.singleton_class
|
@@ -79,12 +82,11 @@ module GraphQL
|
|
79
82
|
root_operation = query.selected_operation
|
80
83
|
root_op_type = root_operation.operation_type || "query"
|
81
84
|
root_type = schema.root_type_for_operation(root_op_type)
|
82
|
-
|
83
|
-
st = get_current_runtime_state
|
84
|
-
st.current_object = query.root_value
|
85
|
-
st.current_result = @response
|
86
85
|
runtime_object = root_type.wrap(query.root_value, context)
|
87
86
|
runtime_object = schema.sync_lazy(runtime_object)
|
87
|
+
@response = GraphQLResultHash.new(nil, root_type, runtime_object, nil, false)
|
88
|
+
st = get_current_runtime_state
|
89
|
+
st.current_result = @response
|
88
90
|
|
89
91
|
if runtime_object.nil?
|
90
92
|
# Root .authorized? returned false.
|
@@ -101,7 +103,7 @@ module GraphQL
|
|
101
103
|
# directly evaluated and the results can be written right into the main response hash.
|
102
104
|
tap_or_each(gathered_selections) do |selections, is_selection_array|
|
103
105
|
if is_selection_array
|
104
|
-
selection_response = GraphQLResultHash.new(nil, nil, false)
|
106
|
+
selection_response = GraphQLResultHash.new(nil, root_type, runtime_object, nil, false)
|
105
107
|
final_response = @response
|
106
108
|
else
|
107
109
|
selection_response = @response
|
@@ -109,26 +111,14 @@ module GraphQL
|
|
109
111
|
end
|
110
112
|
|
111
113
|
@dataloader.append_job {
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
call_method_on_directives(:resolve, runtime_object, directives) do
|
121
|
-
evaluate_selections(
|
122
|
-
runtime_object,
|
123
|
-
root_type,
|
124
|
-
root_op_type == "mutation",
|
125
|
-
selections,
|
126
|
-
selection_response,
|
127
|
-
final_response,
|
128
|
-
nil,
|
129
|
-
st,
|
130
|
-
)
|
131
|
-
end
|
114
|
+
evaluate_selections(
|
115
|
+
root_op_type == "mutation",
|
116
|
+
selections,
|
117
|
+
selection_response,
|
118
|
+
final_response,
|
119
|
+
nil,
|
120
|
+
nil,
|
121
|
+
)
|
132
122
|
}
|
133
123
|
end
|
134
124
|
end
|
@@ -205,36 +195,44 @@ module GraphQL
|
|
205
195
|
NO_ARGS = GraphQL::EmptyObjects::EMPTY_HASH
|
206
196
|
|
207
197
|
# @return [void]
|
208
|
-
def evaluate_selections(
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
198
|
+
def evaluate_selections(is_eager_selection, gathered_selections, selections_result, target_result, parent_object, runtime_state) # rubocop:disable Metrics/ParameterLists
|
199
|
+
runtime_state ||= get_current_runtime_state
|
200
|
+
runtime_state.current_result_name = nil
|
201
|
+
runtime_state.current_result = selections_result
|
202
|
+
# This is a less-frequent case; use a fast check since it's often not there.
|
203
|
+
if (directives = gathered_selections[:graphql_directives])
|
204
|
+
gathered_selections.delete(:graphql_directives)
|
205
|
+
end
|
206
|
+
|
207
|
+
call_method_on_directives(:resolve, selections_result.graphql_application_value, directives) do
|
208
|
+
finished_jobs = 0
|
209
|
+
enqueued_jobs = gathered_selections.size
|
210
|
+
gathered_selections.each do |result_name, field_ast_nodes_or_ast_node|
|
211
|
+
@dataloader.append_job {
|
212
|
+
evaluate_selection(
|
213
|
+
result_name, field_ast_nodes_or_ast_node, is_eager_selection, selections_result, parent_object
|
214
|
+
)
|
215
|
+
finished_jobs += 1
|
216
|
+
if target_result && finished_jobs == enqueued_jobs
|
217
|
+
selections_result.merge_into(target_result)
|
218
|
+
end
|
219
|
+
}
|
220
|
+
# Field resolution may pause the fiber,
|
221
|
+
# so it wouldn't get to the `Resolve` call that happens below.
|
222
|
+
# So instead trigger a run from this outer context.
|
223
|
+
if is_eager_selection
|
224
|
+
@dataloader.clear_cache
|
225
|
+
@dataloader.run
|
226
|
+
@dataloader.clear_cache
|
220
227
|
end
|
221
|
-
}
|
222
|
-
# Field resolution may pause the fiber,
|
223
|
-
# so it wouldn't get to the `Resolve` call that happens below.
|
224
|
-
# So instead trigger a run from this outer context.
|
225
|
-
if is_eager_selection
|
226
|
-
@dataloader.clear_cache
|
227
|
-
@dataloader.run
|
228
|
-
@dataloader.clear_cache
|
229
228
|
end
|
229
|
+
selections_result
|
230
230
|
end
|
231
|
-
|
232
|
-
selections_result
|
233
231
|
end
|
234
232
|
|
235
233
|
# @return [void]
|
236
|
-
def evaluate_selection(result_name, field_ast_nodes_or_ast_node,
|
237
|
-
return if
|
234
|
+
def evaluate_selection(result_name, field_ast_nodes_or_ast_node, is_eager_field, selections_result, parent_object) # rubocop:disable Metrics/ParameterLists
|
235
|
+
return if selections_result.graphql_dead
|
238
236
|
# As a performance optimization, the hash key will be a `Node` if
|
239
237
|
# there's only one selection of the field. But if there are multiple
|
240
238
|
# selections of the field, it will be an Array of nodes
|
@@ -246,13 +244,16 @@ module GraphQL
|
|
246
244
|
ast_node = field_ast_nodes_or_ast_node
|
247
245
|
end
|
248
246
|
field_name = ast_node.name
|
247
|
+
owner_type = selections_result.graphql_result_type
|
249
248
|
field_defn = query.warden.get_field(owner_type, field_name)
|
250
249
|
|
251
250
|
# Set this before calling `run_with_directives`, so that the directive can have the latest path
|
251
|
+
runtime_state = get_current_runtime_state
|
252
252
|
runtime_state.current_field = field_defn
|
253
253
|
runtime_state.current_result = selections_result
|
254
254
|
runtime_state.current_result_name = result_name
|
255
255
|
|
256
|
+
owner_object = selections_result.graphql_application_value
|
256
257
|
if field_defn.dynamic_introspection
|
257
258
|
owner_object = field_defn.owner.wrap(owner_object, context)
|
258
259
|
end
|
@@ -262,24 +263,24 @@ module GraphQL
|
|
262
263
|
resolved_arguments = GraphQL::Execution::Interpreter::Arguments::EMPTY
|
263
264
|
if field_defn.extras.size == 0
|
264
265
|
evaluate_selection_with_resolved_keyword_args(
|
265
|
-
NO_ARGS, resolved_arguments, field_defn, ast_node, field_ast_nodes,
|
266
|
+
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
|
266
267
|
)
|
267
268
|
else
|
268
|
-
evaluate_selection_with_args(resolved_arguments, field_defn, ast_node, field_ast_nodes,
|
269
|
+
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)
|
269
270
|
end
|
270
271
|
else
|
271
272
|
@query.arguments_cache.dataload_for(ast_node, field_defn, owner_object) do |resolved_arguments|
|
272
273
|
runtime_state = get_current_runtime_state # This might be in a different fiber
|
273
|
-
evaluate_selection_with_args(resolved_arguments, field_defn, ast_node, field_ast_nodes,
|
274
|
+
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)
|
274
275
|
end
|
275
276
|
end
|
276
277
|
end
|
277
278
|
|
278
|
-
def evaluate_selection_with_args(arguments, field_defn, ast_node, field_ast_nodes,
|
279
|
+
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
|
279
280
|
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|
|
280
281
|
return_type_non_null = return_type.non_null?
|
281
282
|
if resolved_arguments.is_a?(GraphQL::ExecutionError) || resolved_arguments.is_a?(GraphQL::UnauthorizedError)
|
282
|
-
continue_value(resolved_arguments,
|
283
|
+
continue_value(resolved_arguments, field_defn, return_type_non_null, ast_node, result_name, selection_result)
|
283
284
|
next
|
284
285
|
end
|
285
286
|
|
@@ -328,13 +329,12 @@ module GraphQL
|
|
328
329
|
resolved_arguments.keyword_arguments
|
329
330
|
end
|
330
331
|
|
331
|
-
evaluate_selection_with_resolved_keyword_args(kwarg_arguments, resolved_arguments, field_defn, ast_node, field_ast_nodes,
|
332
|
+
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
333
|
end
|
333
334
|
end
|
334
335
|
|
335
|
-
def evaluate_selection_with_resolved_keyword_args(kwarg_arguments, resolved_arguments, field_defn, ast_node, field_ast_nodes,
|
336
|
+
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
337
|
runtime_state.current_field = field_defn
|
337
|
-
runtime_state.current_object = object
|
338
338
|
runtime_state.current_arguments = resolved_arguments
|
339
339
|
runtime_state.current_result_name = result_name
|
340
340
|
runtime_state.current_result = selection_result
|
@@ -352,6 +352,14 @@ module GraphQL
|
|
352
352
|
end
|
353
353
|
|
354
354
|
field_result = call_method_on_directives(:resolve, object, directives) do
|
355
|
+
if directives.any?
|
356
|
+
# This might be executed in a different context; reset this info
|
357
|
+
runtime_state = get_current_runtime_state
|
358
|
+
runtime_state.current_field = field_defn
|
359
|
+
runtime_state.current_arguments = resolved_arguments
|
360
|
+
runtime_state.current_result_name = result_name
|
361
|
+
runtime_state.current_result = selection_result
|
362
|
+
end
|
355
363
|
# Actually call the field resolver and capture the result
|
356
364
|
app_result = begin
|
357
365
|
@current_trace.execute_field(field: field_defn, ast_node: ast_node, query: query, object: object, arguments: kwarg_arguments) do
|
@@ -367,7 +375,8 @@ module GraphQL
|
|
367
375
|
end
|
368
376
|
end
|
369
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|
|
370
|
-
|
378
|
+
owner_type = selection_result.graphql_result_type
|
379
|
+
continue_value = continue_value(inner_result, field_defn, return_type_non_null, ast_node, result_name, selection_result)
|
371
380
|
if HALT != continue_value
|
372
381
|
was_scoped = runtime_state.was_authorized_by_scope_items
|
373
382
|
runtime_state.was_authorized_by_scope_items = nil
|
@@ -375,25 +384,16 @@ module GraphQL
|
|
375
384
|
end
|
376
385
|
end
|
377
386
|
end
|
378
|
-
|
379
387
|
# If this field is a root mutation field, immediately resolve
|
380
388
|
# all of its child fields before moving on to the next root mutation field.
|
381
389
|
# (Subselections of this mutation will still be resolved level-by-level.)
|
382
390
|
if is_eager_field
|
383
391
|
Interpreter::Resolve.resolve_all([field_result], @dataloader)
|
384
|
-
else
|
385
|
-
# Return this from `after_lazy` because it might be another lazy that needs to be resolved
|
386
|
-
field_result
|
387
392
|
end
|
388
393
|
end
|
389
394
|
|
390
|
-
|
391
|
-
def dead_result?(selection_result)
|
392
|
-
selection_result.graphql_dead # || ((parent = selection_result.graphql_parent) && parent.graphql_dead)
|
393
|
-
end
|
394
|
-
|
395
395
|
def set_result(selection_result, result_name, value, is_child_result, is_non_null)
|
396
|
-
if !
|
396
|
+
if !selection_result.graphql_dead
|
397
397
|
if value.nil? && is_non_null
|
398
398
|
# This is an invalid nil that should be propagated
|
399
399
|
# One caller of this method passes a block,
|
@@ -447,11 +447,13 @@ module GraphQL
|
|
447
447
|
end
|
448
448
|
|
449
449
|
HALT = Object.new
|
450
|
-
def continue_value(value,
|
450
|
+
def continue_value(value, field, is_non_null, ast_node, result_name, selection_result) # rubocop:disable Metrics/ParameterLists
|
451
451
|
case value
|
452
452
|
when nil
|
453
453
|
if is_non_null
|
454
454
|
set_result(selection_result, result_name, nil, false, is_non_null) do
|
455
|
+
# When this comes from a list item, use the parent object:
|
456
|
+
parent_type = selection_result.is_a?(GraphQLResultArray) ? selection_result.graphql_parent.graphql_result_type : selection_result.graphql_result_type
|
455
457
|
# This block is called if `result_name` is not dead. (Maybe a previous invalid nil caused it be marked dead.)
|
456
458
|
err = parent_type::InvalidNullError.new(parent_type, field, value)
|
457
459
|
schema.type_error(err, context)
|
@@ -465,7 +467,7 @@ module GraphQL
|
|
465
467
|
# to avoid the overhead of checking three different classes
|
466
468
|
# every time.
|
467
469
|
if value.is_a?(GraphQL::ExecutionError)
|
468
|
-
if selection_result.nil? || !
|
470
|
+
if selection_result.nil? || !selection_result.graphql_dead
|
469
471
|
value.path ||= current_path
|
470
472
|
value.ast_node ||= ast_node
|
471
473
|
context.errors << value
|
@@ -483,7 +485,7 @@ module GraphQL
|
|
483
485
|
rescue GraphQL::ExecutionError => err
|
484
486
|
err
|
485
487
|
end
|
486
|
-
continue_value(next_value,
|
488
|
+
continue_value(next_value, field, is_non_null, ast_node, result_name, selection_result)
|
487
489
|
elsif value.is_a?(GraphQL::UnauthorizedError)
|
488
490
|
# this hook might raise & crash, or it might return
|
489
491
|
# a replacement value
|
@@ -492,7 +494,7 @@ module GraphQL
|
|
492
494
|
rescue GraphQL::ExecutionError => err
|
493
495
|
err
|
494
496
|
end
|
495
|
-
continue_value(next_value,
|
497
|
+
continue_value(next_value, field, is_non_null, ast_node, result_name, selection_result)
|
496
498
|
elsif GraphQL::Execution::SKIP == value
|
497
499
|
# It's possible a lazy was already written here
|
498
500
|
case selection_result
|
@@ -515,7 +517,7 @@ module GraphQL
|
|
515
517
|
# It's an array full of execution errors; add them all.
|
516
518
|
if value.any? && value.all?(GraphQL::ExecutionError)
|
517
519
|
list_type_at_all = (field && (field.type.list?))
|
518
|
-
if selection_result.nil? || !
|
520
|
+
if selection_result.nil? || !selection_result.graphql_dead
|
519
521
|
value.each_with_index do |error, index|
|
520
522
|
error.ast_node ||= ast_node
|
521
523
|
error.path ||= current_path + (list_type_at_all ? [index] : [])
|
@@ -595,9 +597,9 @@ module GraphQL
|
|
595
597
|
err
|
596
598
|
end
|
597
599
|
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|
|
598
|
-
continue_value = continue_value(inner_object,
|
600
|
+
continue_value = continue_value(inner_object, field, is_non_null, ast_node, result_name, selection_result)
|
599
601
|
if HALT != continue_value
|
600
|
-
response_hash = GraphQLResultHash.new(result_name, selection_result, is_non_null)
|
602
|
+
response_hash = GraphQLResultHash.new(result_name, current_type, continue_value, selection_result, is_non_null)
|
601
603
|
set_result(selection_result, result_name, response_hash, true, is_non_null)
|
602
604
|
|
603
605
|
gathered_selections = gather_selections(continue_value, current_type, next_selections)
|
@@ -611,34 +613,21 @@ module GraphQL
|
|
611
613
|
# (Technically, it's possible that one of those entries _doesn't_ require isolation.)
|
612
614
|
tap_or_each(gathered_selections) do |selections, is_selection_array|
|
613
615
|
if is_selection_array
|
614
|
-
this_result = GraphQLResultHash.new(result_name, selection_result, is_non_null)
|
616
|
+
this_result = GraphQLResultHash.new(result_name, current_type, continue_value, selection_result, is_non_null)
|
615
617
|
final_result = response_hash
|
616
618
|
else
|
617
619
|
this_result = response_hash
|
618
620
|
final_result = nil
|
619
621
|
end
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
call_method_on_directives(:resolve, continue_value, directives) do
|
630
|
-
evaluate_selections(
|
631
|
-
continue_value,
|
632
|
-
current_type,
|
633
|
-
false,
|
634
|
-
selections,
|
635
|
-
this_result,
|
636
|
-
final_result,
|
637
|
-
owner_object.object,
|
638
|
-
runtime_state,
|
639
|
-
)
|
640
|
-
this_result
|
641
|
-
end
|
622
|
+
|
623
|
+
evaluate_selections(
|
624
|
+
false,
|
625
|
+
selections,
|
626
|
+
this_result,
|
627
|
+
final_result,
|
628
|
+
owner_object.object,
|
629
|
+
runtime_state,
|
630
|
+
)
|
642
631
|
end
|
643
632
|
end
|
644
633
|
end
|
@@ -647,7 +636,7 @@ module GraphQL
|
|
647
636
|
# This is true for objects, unions, and interfaces
|
648
637
|
use_dataloader_job = !inner_type.unwrap.kind.input?
|
649
638
|
inner_type_non_null = inner_type.non_null?
|
650
|
-
response_list = GraphQLResultArray.new(result_name, selection_result, is_non_null)
|
639
|
+
response_list = GraphQLResultArray.new(result_name, current_type, response_list, selection_result, is_non_null)
|
651
640
|
set_result(selection_result, result_name, response_list, true, is_non_null)
|
652
641
|
idx = nil
|
653
642
|
list_value = begin
|
@@ -685,7 +674,7 @@ module GraphQL
|
|
685
674
|
end
|
686
675
|
# Detect whether this error came while calling `.each` (before `idx` is set) or while running list *items* (after `idx` is set)
|
687
676
|
error_is_non_null = idx.nil? ? is_non_null : inner_type.non_null?
|
688
|
-
continue_value(list_value,
|
677
|
+
continue_value(list_value, field, error_is_non_null, ast_node, result_name, selection_result)
|
689
678
|
else
|
690
679
|
raise "Invariant: Unhandled type kind #{current_type.kind} (#{current_type})"
|
691
680
|
end
|
@@ -697,7 +686,7 @@ module GraphQL
|
|
697
686
|
call_method_on_directives(:resolve_each, owner_object, ast_node.directives) do
|
698
687
|
# This will update `response_list` with the lazy
|
699
688
|
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|
|
700
|
-
continue_value = continue_value(inner_inner_value,
|
689
|
+
continue_value = continue_value(inner_inner_value, field, inner_type_non_null, ast_node, this_idx, response_list)
|
701
690
|
if HALT != continue_value
|
702
691
|
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)
|
703
692
|
end
|
@@ -719,7 +708,6 @@ module GraphQL
|
|
719
708
|
raw_dir_args = arguments(nil, dir_defn, dir_node)
|
720
709
|
dir_args = continue_value(
|
721
710
|
raw_dir_args, # value
|
722
|
-
dir_defn, # parent_type
|
723
711
|
nil, # field
|
724
712
|
false, # is_non_null
|
725
713
|
dir_node, # ast_node
|
@@ -785,7 +773,6 @@ module GraphQL
|
|
785
773
|
# In that case, this will initialize a new state
|
786
774
|
# to avoid conflicting with the parent fiber.
|
787
775
|
runtime_state = get_current_runtime_state
|
788
|
-
runtime_state.current_object = owner_object
|
789
776
|
runtime_state.current_field = field
|
790
777
|
runtime_state.current_arguments = arguments
|
791
778
|
runtime_state.current_result_name = result_name
|