-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support required arguments with default values #2356
Comments
Thanks for opening this conversation and including those links. It looks like I missed that spec update 🙈 I agree it should work the way the spec says! |
@rmosolgo any chance you could check out my pr? we ran into some issues recently that this would help solve, thanks! |
rmosolgo
added a commit
that referenced
this issue
Aug 8, 2019
Support required arguments with default values [fixes #2356]
@rmosolgo are there any blockers from getting this released that i can help out with? |
No blockers, just released 1.9.10 🚢 ! |
thanks! 💃 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The GraphQL spec has for some time supported required arguments with default values, however graphql-ruby (1.9) appears not to support this
results in the schema compilation error:
Query is invalid: field "account" argument "id" Variable id of type "ID!" is required and will not use the default value. Perhaps you meant to use type "ID".
This seems like a very legitimate use case to me, a less contrived example:
As Rubyists we understand that nil is false-y, so the behaviour here is roughly the same, but from the outside (and the inside) the 1st definition's behaviour seems to me much clearer than the 2nd, in the case where no value is provided.
References:
This behaviour being requested in GraphQL reference implementation, and delivered
Merged spec change which adds "Non-null arguments and input object fields are no longer required to be provided a value/variable if that argument also supplies a default value."
The text was updated successfully, but these errors were encountered: