8000 Fixes variable values of non-null type with default value · graphql-python/graphql-core@c603545 · GitHub
[go: up one dir, main page]

Skip to content

Commit c603545

Browse files
committed
Fixes variable values of non-null type with default value
Replicates graphql/graphql-js@Fixes variable values of non-null type with default value
1 parent db47950 commit c603545

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The current version 3.0.0b1 of GraphQL-core is up-to-date
1616
with GraphQL.js version 14.5.6.
1717

1818
All parts of the API are covered by an extensive test suite
19-
of currently 1989 unit tests.
19+
of currently 1990 unit tests.
2020

2121

2222
## Documentation

src/graphql/execution/values.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ def coerce_variable_values(
9494
coerced_values[var_name] = value_from_ast(
9595
var_def_node.default_value, var_type
9696
)
97-
98-
if is_non_null_type(var_type):
97+
elif is_non_null_type(var_type):
9998
var_type_str = inspect(var_type)
10099
on_error(
101100
GraphQLError(

tests/execution/test_variables.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,17 @@ def allows_nullable_inputs_to_be_set_to_a_value_directly():
546546
assert result == ({"fieldWithNullableStringInput": "'a'"}, None)
547547

548548
def describe_handles_non_nullable_scalars():
549+
def allows_non_nullable_variable_to_be_omitted_given_a_default():
550+
result = execute_query(
551+
"""
552+
query ($value: String! = "default") {
553+
fieldWithNullableStringInput(input: $value)
554+
}
555+
"""
556+
)
557+
558+
assert result == ({"fieldWithNullableStringInput": "'default'"}, None)
559+
549560
def allows_non_nullable_inputs_to_be_omitted_given_a_default():
550561
result = execute_query(
551562
"""

0 commit comments

Comments
 (0)
0