@@ -83,6 +83,7 @@ def on_resolve(data):
8383 if isinstance (data , Observable ):
8484 return data
8585
86+ tracing_middleware .end ()
8687 extensions = dict (tracing = tracing_middleware .tracing_dict )
8788
8889 if not context .errors :
@@ -121,7 +122,7 @@ def execute_operation(exe_context, operation, root_value):
121122 )
122123 return subscribe_fields (exe_context , type , root_value , fields )
123124
124- return execute_fields (exe_context , type , root_value , fields )
125+ return execute_fields (exe_context , type , root_value , fields , None )
125126
126127
127128def execute_fields_serially (exe_context , parent_type , source_value , fields ):
@@ -152,14 +153,13 @@ def execute_field(prev_promise, response_name):
152153 return functools .reduce (execute_field , fields .keys (), Promise .resolve (collections .OrderedDict ()))
153154
154155
155- def execute_fields (exe_context , parent_type , source_value , fields ):
156+ def execute_fields (exe_context , parent_type , source_value , fields , info ):
156157 contains_promise = False
157158
158159 final_results = OrderedDict ()
159160
160161 for response_name , field_asts in fields .items ():
161- result = resolve_field (exe_context , parent_type ,
162- source_value , field_asts )
162+ result = resolve_field (exe_context , parent_type , source_value , field_asts , info )
163163 if result is Undefined :
164164 continue
165165
@@ -211,7 +211,7 @@ def catch_error(error):
211211 return Observable .merge (observables )
212212
213213
214- def resolve_field (exe_context , parent_type , source , field_asts ):
214+ def resolve_field (exe_context , parent_type , source , field_asts , parent_info ):
215215 field_ast = field_asts [0 ]
216216 field_name = field_ast .name .value
217217
@@ -246,12 +246,12 @@ def resolve_field(exe_context, parent_type, source, field_asts):
246246 root_value = exe_context .root_value ,
247247 operation = exe_context .operation ,
248248 variable_values = exe_context .variable_values ,
249- context = context
249+ context = context ,
250+ path = parent_info .path + [field_name ] if parent_info else [field_name ]
250251 )
251252
252253 executor = exe_context .executor
253- result = resolve_or_error (resolve_fn_middleware ,
254- source , info , args , executor )
254+ result = resolve_or_error (resolve_fn_middleware , source , info , args , executor )
255255
256256 return complete_value_catching_error (
257257 exe_context ,
@@ -377,7 +377,6 @@ def complete_value(exe_context, return_type, field_asts, info, result):
377377 """
378378 # If field type is NonNull, complete for inner type, and throw field error
379379 # if result is null.
380-
381380 if is_thenable (result ):
382381 return Promise .resolve (result ).then (
383382 lambda resolved : complete_value (
@@ -432,13 +431,16 @@ def complete_list_value(exe_context, return_type, field_asts, info, result):
432431 item_type = return_type .of_type
433432 completed_results = []
434433 contains_promise = False
434+ index = 0
435435 for item in result :
436- completed_item = complete_value_catching_error (
437- exe_context , item_type , field_asts , info , item )
436+ new_info = info .clone ()
437+ new_info .path += [index ]
438+ completed_item = complete_value_catching_error (exe_context , item_type , field_asts , new_info , item )
438439 if not contains_promise and is_thenable (completed_item ):
439440 contains_promise = True
440441
441442 completed_results .append (completed_item )
443+ index += 1
442444
443445 return Promise .all (completed_results ) if contains_promise else completed_results
444446
@@ -514,7 +516,7 @@ def complete_object_value(exe_context, return_type, field_asts, info, result):
514516
515517 # Collect sub-fields to execute to complete this value.
516518 subfield_asts = exe_context .get_sub_fields (return_type , field_asts )
517- return execute_fields (exe_context , return_type , result , subfield_asts )
519+ return execute_fields (exe_context , return_type , result , subfield_asts , info )
518520
519521
520522def complete_nonnull_value (exe_context , return_type , field_asts , info , result ):
0 commit comments