@@ -981,6 +981,9 @@ def complete_object_value(
981
981
result : Any ,
982
982
) -> AwaitableOrValue [Dict [str , Any ]]:
983
983
"""Complete an Object value by executing all sub-selections."""
984
+ # Collect sub-fields to execute to complete this value.
985
+ sub_field_nodes = self .collect_subfields (return_type , field_nodes )
986
+
984
987
# If there is an `is_type_of()` predicate function, call it with the current
985
988
# result. If `is_type_of()` returns False, then raise an error rather than
986
989
# continuing execution.
@@ -989,33 +992,20 @@ def complete_object_value(
989
992
990
993
if self .is_awaitable (is_type_of ):
991
994
992
- async def collect_and_execute_subfields_async () -> Dict [str , Any ]:
995
+ async def execute_subfields_async () -> Dict [str , Any ]:
993
996
if not await is_type_of : # type: ignore
994
997
raise invalid_return_type_error (
995
998
return_type , result , field_nodes
996
999
)
997
- return self .collect_and_execute_subfields (
998
- return_type , field_nodes , path , result
1000
+ return self .execute_fields (
1001
+ return_type , result , path , sub_field_nodes
999
1002
) # type: ignore
1000
1003
1001
- return collect_and_execute_subfields_async ()
1004
+ return execute_subfields_async ()
1002
1005
1003
1006
if not is_type_of :
1004
1007
raise invalid_return_type_error (return_type , result , field_nodes )
1005
1008
1006
- return self .collect_and_execute_subfields (
1007
- return_type , field_nodes , path , result
1008
- )
1009
-
1010
- def collect_and_execute_subfields (
1011
- self ,
1012
- return_type : GraphQLObjectType ,
1013
- field_nodes : List [FieldNode ],
1014
- path : Path ,
1015
- result : Any ,
1016
- ) -> AwaitableOrValue [Dict [str , Any ]]:
1017
- """Collect sub-fields to execute to complete this value."""
1018
- sub_field_nodes = self .collect_subfields (return_type , field_nodes )
1019
1009
return self .execute_fields (return_type , result , path , sub_field_nodes )
1020
1010
1021
1011
def collect_subfields (
0 commit comments