Skip to content

Commit 7145ea7

Browse files
committed
Fix test_builds_a_schema_with_field_arguments_with_default_values.
1 parent fa41da8 commit 7145ea7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-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: 6 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,13 @@ 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((field.out_name or field_name, field.default_value))
6667

6768
continue
6869

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

7374
# We use out_name as the output name for the
7475
# dict if exists
75-
obj[field.out_name or field_name] = field_value
76+
obj_items.append((field.out_name or field_name, field_value))
77+
78+
obj = OrderedDict(obj_items)
7679

7780
return type.create_container(obj)
7881

0 commit comments

Comments
 (0)