-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[typescript] Non-null default fields are incorrectly optional #5112
Comments
If you provide a default value for an input field, it means that input field is optional for the client side. |
Your reasoning is a little off. Test cannot be set to However, I understand what you mean. This issue is more about server implementations where the resolver should know the arguments are provided. I've added a "defaultValue" option to the |
I was talking about this behavior so in this case |
Yes, I am aware, but as I stated, Thus it would be better to have an |
Merged and published. Thanks @jun-sheaf! |
Describe the bug
Default values are handled incorrectly.
To Reproduce
Steps to reproduce the behavior:
Suppose we have the schema
Then
graphql-codegen
will optionalize the argumenttest
.Expected behavior
The above should not be optional as
String!
is nevernull
.Environment:
@graphql-codegen/...
: Latest as of issue dateThe text was updated successfully, but these errors were encountered: