Skip to content

Commit b8f5e05

Browse files
committed
Fix test_builds_a_schema_with_field_arguments_with_default_values.
1 parent fa41da8 commit b8f5e05

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

graphql/utils/build_client_schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ def build_input_object_def(input_object_introspection):
208208
fields=lambda: build_input_value_def_map(
209209
input_object_introspection.get("inputFields"), GraphQLInputObjectField
210210
),
211+
container_type=OrderedDict,
211212
)
212213

213214
type_builders = {

graphql/utils/value_from_ast.py

Lines changed: 8 additions & 3 deletions
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)