Skip to content

Commit 47591b8

Browse files
committed
update value_from_ast/ast_from_value
1 parent d04cd9a commit 47591b8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

graphql/utils/ast_from_value.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
from ..type.definition import (GraphQLEnumType, GraphQLInputObjectType,
99
GraphQLList, GraphQLNonNull)
1010
from ..type.scalars import GraphQLFloat
11+
from ..utils.undefined import UndefinedDefaultValue
1112

1213

1314
def ast_from_value(value, type=None):
1415
if isinstance(type, GraphQLNonNull):
1516
return ast_from_value(value, type.of_type)
1617

18+
if value is UndefinedDefaultValue:
19+
return
20+
1721
if value is None:
1822
return ast.NullValue()
1923

graphql/utils/value_from_ast.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from ..language import ast
22
from ..type import (GraphQLEnumType, GraphQLInputObjectType, GraphQLList,
33
GraphQLNonNull, GraphQLScalarType)
4+
from ..utils.undefined import UndefinedDefaultValue
45

56

67
def value_from_ast(value_ast, type, variables=None):
@@ -48,7 +49,7 @@ def value_from_ast(value_ast, type, variables=None):
4849
obj = {}
4950
for field_name, field in fields.items():
5051
if field_name not in field_asts:
51-
if field.default_value is not None:
52+
if field.default_value is not UndefinedDefaultValue:
5253
# We use out_name as the output name for the
5354
# dict if exists
5455
obj[field.out_name or field_name] = field.default_value

0 commit comments

Comments
 (0)