How to throw validation error for a nullable field? #1203
Unanswered
Cavallando
asked this question in
Q&A
Replies: 1 comment
-
Nullable + validation = (null/undefined) or the correct value If you want to throw error on null, just make the field non-nullable, so GraphQL won't let you skip that field or pass null. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Right now it appears that having a validation on a nullable field results in the the field being set to
undefined
as opposed the the validation error being thrown. From a user perspective, I would expect the error to be thrown so that I have some action to take as opposed to no error being thrown and the user being left confused as to why the field I input was not accepted. Am I missing something from the docs? Is this supported?Example:
Beta Was this translation helpful? Give feedback.
All reactions