File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
+ from collections import OrderedDict
2
3
3
4
from pytest import raises
4
5
17
18
parse_literal = lambda v : 'DeserializedValue' if v .value == 'SerializedValue' else None
18
19
)
19
20
20
- TestInputObject = GraphQLInputObjectType ('TestInputObject' , {
21
- 'a' : GraphQLInputObjectField (GraphQLString ),
22
- 'b' : GraphQLInputObjectField (GraphQLList (GraphQLString )),
23
- 'c' : GraphQLInputObjectField (GraphQLNonNull (GraphQLString )),
24
- 'd' : GraphQLInputObjectField (TestComplexScalar )
25
- } )
21
+ TestInputObject = GraphQLInputObjectType ('TestInputObject' , OrderedDict ([
22
+ ( 'a' , GraphQLInputObjectField (GraphQLString ) ),
23
+ ( 'b' , GraphQLInputObjectField (GraphQLList (GraphQLString ) )),
24
+ ( 'c' , GraphQLInputObjectField (GraphQLNonNull (GraphQLString ) )),
25
+ ( 'd' , GraphQLInputObjectField (TestComplexScalar ) )
26
+ ]) )
26
27
27
28
stringify = lambda obj : json .dumps (obj , sort_keys = True )
28
29
Original file line number Diff line number Diff line change @@ -522,6 +522,9 @@ def _define_field_map(self):
522
522
if callable (fields ):
523
523
fields = fields ()
524
524
525
+ if not isinstance (fields , OrderedDict ):
526
+ fields = OrderedDict (sorted (list (fields .items ())))
527
+
525
528
assert isinstance (fields , collections .Mapping ) and len (fields ) > 0 , (
526
529
'{} fields must be a mapping (dict / OrderedDict) with field names as keys or a '
527
530
'function which returns such a mapping.'
You can’t perform that action at this time.
0 commit comments