-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Missing optional value in input type throws exception #4354
Comments
This is an issue for us as well. I thought it only occurred via enums... |
@KreativJos Optional does not mean nullable. See more for context (#1808) |
@PascalSenn That was not what I was referencing to. I have GraphQLTypes which reference models with optional values:
With the annotation-method, it looks like this:
|
Yeah, but Optional is only meant for arguments to be able to differentiate between it being null or a default value. As far as I'm aware the are no default values for object type fields, so optional doesn't make sense here. Just get rid of the optional and your code should function as normal, considering thr nullability is already set by you, specifiying thr type. |
But I want to know if the user has explicitly set the field, which is what |
Sorry my bad I thought you were using Optional on object type fields and not on input object types. My bad! |
Do we have any ETA for this issue? |
Wondering if this is stale for a reason? Are you no longer planning to address this in an upcoming release? |
This issue should not be stale - a solution should be available. |
Experiencing the same problem, in V11 this worked, in V12 it results in this hard to track down |
This is a bug. The issue is that the input parser assumes a Nullable but finds an in as a prop. I am working on this now. |
This is now fixed and integrated into 12.13.0-preview.2 |
Thank you very much, we tested it and it appears the HotChocolate 11 behavior has been restored. |
Thanks a lot. The 12.13.0-preview.2 package seems to fix the described problem for my team as well! I'm finally able to remove all the descriptor.DefaultValue / reflection shenanigans we've been using as a workaround. |
Is there an existing issue for this?
Describe the bug
In contrast to V11 a mutation fails if an optional input field is not set and the field is mapped to a non nullable property.
Steps to reproduce
mutation{ addBook(book: {title: "123", someNumber: 1}){ title someNumber } }
--> it worksmutation{ addBook(book: {title: "123"}){ title someNumber } }
--> it failsRelevant log output
Additional Context?
https://hotchocolategraphql.slack.com/archives/CD9TNKT8T/p1635433560328800
Product
Hot Chocolate
Version
12.0.1
The text was updated successfully, but these errors were encountered: