Skip to content

Commit 67bfc6a

Browse files
committed
Fix test_builds_a_schema_with_field_arguments_with_default_values.
1 parent fa41da8 commit 67bfc6a

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

graphql/execution/tests/test_executor_thread.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
###
2121
# Disabled because all these tests are flaky
22-
# The culprit lies in the fact that the `ThreadExecutor` incorrectly assumes that
22+
# The culprit is that the `ThreadExecutor` incorrectly assumes that
2323
# the `Promise` class is thread-safe.
2424
# See https://git.io/JeA3s
2525
###

graphql/type/definition.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def __init__(
649649
self.name = name
650650
self.description = description
651651
if container_type is None:
652-
container_type = dict # type: ignore
652+
container_type = OrderedDict # type: ignore
653653
assert callable(container_type), "container_type must be callable"
654654
self.container_type = container_type
655655
self._fields = fields

graphql/utils/value_from_ast.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from ..language import ast
2+
from ..pyutils.ordereddict import OrderedDict
23
from ..type import (
34
GraphQLEnumType,
45
GraphQLInputObjectType,
@@ -56,13 +57,15 @@ def value_from_ast(value_ast, type, variables=None):
5657
for field_ast in value_ast.fields:
5758
field_asts[field_ast.name.value] = field_ast
5859

59-
obj = {}
60+
obj_items = []
6061
for field_name, field in fields.items():
6162
if field_name not in field_asts:
6263
if field.default_value is not None:
6364
# We use out_name as the output name for the
6465
# dict if exists
65-
obj[field.out_name or field_name] = field.default_value
66+
obj_items.append(
67+
(field.out_name or field_name, field.default_value)
68+
)
6669

6770
continue
6871

@@ -72,7 +75,9 @@ def value_from_ast(value_ast, type, variables=None):
7275

7376
# We use out_name as the output name for the
7477
# dict if exists
75-
obj[field.out_name or field_name] = field_value
78+
obj_items.append((field.out_name or field_name, field_value))
79+
80+
obj = OrderedDict(obj_items)
7681

7782
return type.create_container(obj)
7883

0 commit comments

Comments
 (0)