Replies: 5 comments
-
This works as designed. |
Beta Was this translation helpful? Give feedback.
-
Optional doesnt mean nullable, but based on the behavior, it doesnt seem like it means optional either? Optional would imply that one could opt from providing it, and at least the entry point of the mtuation method would just not have that value be set |
Beta Was this translation helpful? Give feedback.
-
No as a argument can be non nullable but still not have to be provided (DefaultValue) |
Beta Was this translation helpful? Give feedback.
-
Also, in the case where I'm explicitly telling hotchocolate to ignore what's being passed in for an update, is there a reason it should be generating a required field is missing? We ignore what they pass, but if they dont pass it, show validation errors? |
Beta Was this translation helpful? Give feedback.
-
I've created #5013 in regards to what I saw in the slack channel from the discussion thread around this. Let me know if this helps. |
Beta Was this translation helpful? Give feedback.
-
Is there an existing issue for this?
Describe the bug
RequiredInputFieldIsMissing
seems to be getting fired in cases it seems like it shouldn't be.public Optional<bool> IsAdmin {get;set;}
and object type doesn't explicitly override handling, I see this exception when omitting isAdmin from the mutation call. (if I define as Optional<bool?>, it doesn't throw that error, but imo seems like that shouldn't be required)descriptor.Field(input => input.Class).Ignore();
, I get the same error saying required input field 'isAdmin' is missing.Steps to reproduce
FirstName
,LastName
,Class
, but omittingIsAdmin
and expect errorrequired input field 'IsAdmin' is missing
FirstName
,LastName
,IsAdmin
but omittingClass
and expect errorrequired input field 'Class' is missing
Relevant log output
No response
Additional Context?
Its very possible this is a configuration issue, and I'm not sure if the descriptor for the mutation where default is passed into args of a method is correct (this is in updating code). I'm also nto even sure this stuff isnt the expected behavior, but I'd like to try understand what we'd expect to have happen in these situations.
Seems like this error comes from
CreateDefaultValue
inInputParser.cs
To me it kind of seems like typekind is being set to
TypeKind.NonNull
, but for the purposes of this particular mutation (an update) I'd expect neither scenario to trigger this.Product
Hot Chocolate
Version
12.7.0
Beta Was this translation helpful? Give feedback.
All reactions