Skip to content

Commit 65ed2b3

Browse files
committed
Remove un-needed conditional check.
1 parent cf10db6 commit 65ed2b3

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

graphql/core/utils/is_valid_literal_value.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ def is_valid_literal_value(type, value_ast):
1515
if isinstance(type, GraphQLNonNull):
1616
of_type = type.of_type
1717
if not value_ast:
18-
if of_type.name:
19-
return [u'Expected "{}", found null.'.format(type)]
20-
21-
return [u'Expected non-null value, found null.']
18+
return [u'Expected "{}", found null.'.format(type)]
2219

2320
return is_valid_literal_value(of_type, value_ast)
2421

graphql/core/utils/is_valid_value.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ def is_valid_value(value, type):
2121
if isinstance(type, GraphQLNonNull):
2222
of_type = type.of_type
2323
if value is None:
24-
if hasattr(of_type, 'name'):
25-
return [u'Expected "{}", found null.'.format(type)]
26-
27-
return [u'Expected non-null value, found null.']
24+
return [u'Expected "{}", found null.'.format(type)]
2825

2926
return is_valid_value(value, of_type)
3027

@@ -52,7 +49,7 @@ def is_valid_value(value, type):
5249
fields = type.get_fields()
5350
errors = []
5451

55-
for provided_field in value.keys():
52+
for provided_field in sorted(value.keys()):
5653
if provided_field not in fields:
5754
errors.append(u'In field "{}": Unknown field.'.format(provided_field))
5855

0 commit comments

Comments
 (0)