4141from ..error import GraphQLError , GraphQLFormattedError , located_error
4242from ..language import (
4343 DocumentNode ,
44- FieldNode ,
4544 FragmentDefinitionNode ,
4645 OperationDefinitionNode ,
4746 OperationType ,
7574 is_object_type ,
7675)
7776from .async_iterables import map_async_iterable
78- from .collect_fields import FieldsAndPatches , collect_fields , collect_subfields
77+ from .collect_fields import (
78+ FieldGroup ,
79+ FieldsAndPatches ,
80+ collect_fields ,
81+ collect_subfields ,
82+ )
7983from .middleware import MiddlewareManager
8084from .values import get_argument_values , get_directive_values , get_variable_values
8185
@@ -837,7 +841,7 @@ def execute_fields_serially(
837841 parent_type : GraphQLObjectType ,
838842 source_value : Any ,
839843 path : Path | None ,
840- fields : dict [str , list [ FieldNode ] ],
844+ fields : dict [str , FieldGroup ],
841845 ) -> AwaitableOrValue [dict [str , Any ]]:
842846 """Execute the given fields serially.
843847
@@ -847,7 +851,7 @@ def execute_fields_serially(
847851 is_awaitable = self .is_awaitable
848852
849853 def reducer (
850- results : dict [str , Any ], field_item : tuple [str , list [ FieldNode ] ]
854+ results : dict [str , Any ], field_item : tuple [str , FieldGroup ]
851855 ) -> AwaitableOrValue [dict [str , Any ]]:
852856 response_name , field_nodes = field_item
853857 field_path = Path (path , response_name , parent_type .name )
@@ -877,7 +881,7 @@ def execute_fields(
877881 parent_type : GraphQLObjectType ,
878882 source_value : Any ,
879883 path : Path | None ,
880- fields : dict [str , list [ FieldNode ] ],
884+ fields : dict [str , FieldGroup ],
881885 async_payload_record : AsyncPayloadRecord | None = None ,
882886 ) -> AwaitableOrValue [dict [str , Any ]]:
883887 """Execute the given fields concurrently.
@@ -927,7 +931,7 @@ def execute_field(
927931 self ,
928932 parent_type : GraphQLObjectType ,
929933 source : Any ,
930- field_nodes : list [ FieldNode ] ,
934+ field_nodes : FieldGroup ,
931935 path : Path ,
932936 async_payload_record : AsyncPayloadRecord | None = None ,
933937 ) -> AwaitableOrValue [Any ]:
@@ -996,7 +1000,7 @@ async def await_completed() -> Any:
9961000 def build_resolve_info (
9971001 self ,
9981002 field_def : GraphQLField ,
999- field_nodes : list [ FieldNode ] ,
1003+ field_nodes : FieldGroup ,
10001004 parent_type : GraphQLObjectType ,
10011005 path : Path ,
10021006 ) -> GraphQLResolveInfo :
@@ -1024,7 +1028,7 @@ def build_resolve_info(
10241028 def complete_value (
10251029 self ,
10261030 return_type : GraphQLOutputType ,
1027- field_nodes : list [ FieldNode ] ,
1031+ field_nodes : FieldGroup ,
10281032 info : GraphQLResolveInfo ,
10291033 path : Path ,
10301034 result : Any ,
@@ -1113,7 +1117,7 @@ def complete_value(
11131117 async def complete_awaitable_value (
11141118 self ,
11151119 return_type : GraphQLOutputType ,
1116- field_nodes : list [ FieldNode ] ,
1120+ field_nodes : FieldGroup ,
11171121 info : GraphQLResolveInfo ,
11181122 path : Path ,
11191123 result : Any ,
@@ -1143,7 +1147,7 @@ async def complete_awaitable_value(
11431147 return completed
11441148
11451149 def get_stream_values (
1146- self , field_nodes : list [ FieldNode ] , path : Path
1150+ self , field_nodes : FieldGroup , path : Path
11471151 ) -> StreamArguments | None :
11481152 """Get stream values.
11491153
@@ -1182,7 +1186,7 @@ def get_stream_values(
11821186 async def complete_async_iterator_value (
11831187 self ,
11841188 item_type : GraphQLOutputType ,
1185- field_nodes : list [ FieldNode ] ,
1189+ field_nodes : FieldGroup ,
11861190 info : GraphQLResolveInfo ,
11871191 path : Path ,
11881192 iterator : AsyncIterator [Any ],
@@ -1269,7 +1273,7 @@ async def complete_async_iterator_value(
12691273 def complete_list_value (
12701274 self ,
12711275 return_type : GraphQLList [GraphQLOutputType ],
1272- field_nodes : list [ FieldNode ] ,
1276+ field_nodes : FieldGroup ,
12731277 info : GraphQLResolveInfo ,
12741278 path : Path ,
12751279 result : AsyncIterable [Any ] | Iterable [Any ],
@@ -1367,7 +1371,7 @@ def complete_list_item_value(
13671371 complete_results : list [Any ],
13681372 errors : list [GraphQLError ],
13691373 item_type : GraphQLOutputType ,
1370- field_nodes : list [ FieldNode ] ,
1374+ field_nodes : FieldGroup ,
13711375 info : GraphQLResolveInfo ,
13721376 item_path : Path ,
13731377 async_payload_record : AsyncPayloadRecord | None ,
@@ -1442,7 +1446,7 @@ def complete_leaf_value(return_type: GraphQLLeafType, result: Any) -> Any:
14421446 def complete_abstract_value (
14431447 self ,
14441448 return_type : GraphQLAbstractType ,
1445- field_nodes : list [ FieldNode ] ,
1449+ field_nodes : FieldGroup ,
14461450 info : GraphQLResolveInfo ,
14471451 path : Path ,
14481452 result : Any ,
@@ -1496,7 +1500,7 @@ def ensure_valid_runtime_type(
14961500 self ,
14971501 runtime_type_name : Any ,
14981502 return_type : GraphQLAbstractType ,
1499- field_nodes : list [ FieldNode ] ,
1503+ field_nodes : FieldGroup ,
15001504 info : GraphQLResolveInfo ,
15011505 result : Any ,
15021506 ) -> GraphQLObjectType :
@@ -1557,7 +1561,7 @@ def ensure_valid_runtime_type(
15571561 def complete_object_value (
15581562 self ,
15591563 return_type : GraphQLObjectType ,
1560- field_nodes : list [ FieldNode ] ,
1564+ field_nodes : FieldGroup ,
15611565 info : GraphQLResolveInfo ,
15621566 path : Path ,
15631567 result : Any ,
@@ -1593,7 +1597,7 @@ async def execute_subfields_async() -> dict[str, Any]:
15931597 def collect_and_execute_subfields (
15941598 self ,
15951599 return_type : GraphQLObjectType ,
1596- field_nodes : list [ FieldNode ] ,
1600+ field_nodes : FieldGroup ,
15971601 path : Path ,
15981602 result : Any ,
15991603 async_payload_record : AsyncPayloadRecord | None ,
@@ -1619,7 +1623,7 @@ def collect_and_execute_subfields(
16191623 return sub_fields
16201624
16211625 def collect_subfields (
1622- self , return_type : GraphQLObjectType , field_nodes : list [ FieldNode ]
1626+ self , return_type : GraphQLObjectType , field_nodes : FieldGroup
16231627 ) -> FieldsAndPatches :
16241628 """Collect subfields.
16251629
@@ -1688,7 +1692,7 @@ def execute_deferred_fragment(
16881692 self ,
16891693 parent_type : GraphQLObjectType ,
16901694 source_value : Any ,
1691- fields : dict [str , list [ FieldNode ] ],
1695+ fields : dict [str , FieldGroup ],
16921696 label : str | None = None ,
16931697 path : Path | None = None ,
16941698 parent_context : AsyncPayloadRecord | None = None ,
@@ -1724,7 +1728,7 @@ def execute_stream_field(
17241728 path : Path ,
17251729 item_path : Path ,
17261730 item : AwaitableOrValue [Any ],
1727- field_nodes : list [ FieldNode ] ,
1731+ field_nodes : FieldGroup ,
17281732 info : GraphQLResolveInfo ,
17291733 item_type : GraphQLOutputType ,
17301734 label : str | None = None ,
@@ -1817,7 +1821,7 @@ async def await_completed_items() -> list[Any] | None:
18171821 async def execute_stream_iterator_item (
18181822 self ,
18191823 iterator : AsyncIterator [Any ],
1820- field_nodes : list [ FieldNode ] ,
1824+ field_nodes : FieldGroup ,
18211825 info : GraphQLResolveInfo ,
18221826 item_type : GraphQLOutputType ,
18231827 async_payload_record : StreamRecord ,
@@ -1851,7 +1855,7 @@ async def execute_stream_iterator(
18511855 self ,
18521856 initial_index : int ,
18531857 iterator : AsyncIterator [Any ],
1854- field_modes : list [ FieldNode ] ,
1858+ field_modes : FieldGroup ,
18551859 info : GraphQLResolveInfo ,
18561860 item_type : GraphQLOutputType ,
18571861 path : Path ,
@@ -2238,7 +2242,7 @@ def handle_field_error(
22382242
22392243
22402244def invalid_return_type_error (
2241- return_type : GraphQLObjectType , result : Any , field_nodes : list [ FieldNode ]
2245+ return_type : GraphQLObjectType , result : Any , field_nodes : FieldGroup
22422246) -> GraphQLError :
22432247 """Create a GraphQLError for an invalid return type."""
22442248 return GraphQLError (
0 commit comments