-
Notifications
You must be signed in to change notification settings - Fork 823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-null InputField with default_value is not supported #1220
Comments
@radekwlsk is this on Graphene v2? I think this should be fixed in v3 with the upgrade to graphql-core v3. |
Yeah, that's v2. I will have to check that on v3 but not sure if our production app is ready for that jump. I will have to create some test project for it. |
@jkimbo I've bumped the dependencies to
and it still errors out when required input field with a default is not provided. But from what you are saying I take that it is an issue with |
Hmm thats strange, I've added a test to try and show that it should work: https://github.com/graphql-python/graphene/compare/input-type-default Can you check your code with the test that I've written? |
Same thing with your test code copied
I will check dependency tree once again. |
@jkimbo Ok, I've once again installed all dependencies (correctly this time) and it indeed works on v3. Closing |
Glad to hear! |
According to GraphQL spec change introduced in this pull request graphql/graphql-spec#418 it should be possible to define input field as non-null with default and make it take that default value if not provided.
when provided as
{"name": "foo"}
results inWhen input field has a default (
true
here) and is non-null providing{"name": "foo"}
should results in passing{"name": "foo", "myValue": true}
to the mutation and no errors.Error
should only occur when input has
myValue
explicitly provided asnull
/None
.That should be the default behaviour according to GraphQL spec: graphql/graphql-spec#418
The text was updated successfully, but these errors were encountered: