Skip to content

Commit 04f07df

Browse files
committed
type definitions: Use consistent order for public fields
Replicates graphql/graphql-js@7782190
1 parent 9bd39d8 commit 04f07df

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/graphql/type/definition.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,11 @@ def assert_scalar_type(type_: Any) -> GraphQLScalarType:
415415
class GraphQLField:
416416
"""Definition of a GraphQL field"""
417417

418+
description: Optional[str]
418419
type: "GraphQLOutputType"
419420
args: GraphQLArgumentMap
420421
resolve: Optional["GraphQLFieldResolver"]
421422
subscribe: Optional["GraphQLFieldResolver"]
422-
description: Optional[str]
423423
deprecation_reason: Optional[str]
424424
ast_node: Optional[FieldDefinitionNode]
425425

@@ -490,11 +490,11 @@ def __eq__(self, other):
490490

491491
def to_kwargs(self) -> Dict[str, Any]:
492492
return dict(
493+
description=self.description,
493494
type_=self.type,
494495
args=self.args.copy() if self.args else None,
495496
resolve=self.resolve,
496497
subscribe=self.subscribe,
497-
description=self.description,
498498
deprecation_reason=self.deprecation_reason,
499499
ast_node=self.ast_node,
500500
)
@@ -550,9 +550,9 @@ class GraphQLResolveInfo(NamedTuple):
550550
class GraphQLArgument:
551551
"""Definition of a GraphQL argument"""
552552

553+
description: Optional[str]
553554
type: "GraphQLInputType"
554555
default_value: Any
555-
description: Optional[str]
556556
out_name: Optional[str] # for transforming names (extension of GraphQL.js)
557557
ast_node: Optional[InputValueDefinitionNode]
558558

@@ -589,9 +589,9 @@ def __eq__(self, other):
589589

590590
def to_kwargs(self) -> Dict[str, Any]:
591591
return dict(
592+
description=self.description,
592593
type_=self.type,
593594
default_value=self.default_value,
594-
description=self.description,
595595
out_name=self.out_name,
596596
ast_node=self.ast_node,
597597
)

src/graphql/type/schema.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ def __init__(
151151

152152
self._validation_errors = None
153153

154+
self.ast_node = ast_node
155+
self.extension_ast_nodes = (
156+
cast(FrozenList[ast.SchemaExtensionNode], extension_ast_nodes)
157+
if extension_ast_nodes
158+
else None
159+
)
160+
154161
self.query_type = query
155162
self.mutation_type = mutation
156163
self.subscription_type = subscription
@@ -160,12 +167,6 @@ def __init__(
160167
if directives is None
161168
else cast(FrozenList[GraphQLDirective], directives)
162169
)
163-
self.ast_node = ast_node
164-
self.extension_ast_nodes = (
165-
cast(FrozenList[ast.SchemaExtensionNode], extension_ast_nodes)
166-
if extension_ast_nodes
167-
else None
168-
)
169170

170171
# Build type map now to detect any errors within this schema.
171172
initial_types: List[Optional[GraphQLNamedType]] = [

0 commit comments

Comments
 (0)