Replies: 2 comments
-
Is optional even really supported anymore? Seems like documentation referenced it once that I could find, and its brief mentioned showed it being used in method parameters, or as properties on input objects... If its supported, I'd love to see a real world application... or if someone could give me an idea of how people build mutation input types with fields that can be optionally provided, and how the wire that up... I'd be happy to contribute documentation |
Beta Was this translation helpful? Give feedback.
-
Optional is documented here: https://chillicream.com/docs/hotchocolate/v12/defining-a-schema/input-object-types/#optional-properties |
Beta Was this translation helpful? Give feedback.
-
Is there an existing issue for this?
Describe the bug
Having a Optional parameter on a model I share between input and objecttypes causes an error in hotchocolate runtime
Boolean cannot serialize the given value.
Should
Optional<T>
ONLY be used in input type objects alone? Should they even be something I'd be including in any of my classes?Steps to reproduce
Relevant log output
No response
Additional Context?
I feel like mention in documentation on
Optional<T>
is minimal, and I'm unclear HOW they should be used. Should this be purely somethign that exists in input types themselves and no where else? If that's the case, why does hotchocolate require you to provide a value for anOptional<bool>
or provide a default? Seems like Optional in the name means providing it should be optional, and that within the query, the optional value would just not be specified or whatever.Product
Hot Chocolate
Version
12.7.0
Beta Was this translation helpful? Give feedback.
All reactions