You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the validation process fails inferring that the empty value '' is not in the stringEnum, even if I've specified the optional and the nullable features. Is this by design? Or shouldn't be the null and empty string, in this case, considered as part of the enumeration or checked before validating the enum? If so it should be documented or at least using optional or nullable with enum should throw an exception...
The text was updated successfully, but these errors were encountered:
I've checked the code, and it looks the half is by design and half is (maybe bug or not).
the optional: true checks that Status === undefined˙.
the nullable: true checks that Status === null
But the empty string is neither of both. There is an empty: false property that disables accepting empty string, but empty: true has no effect, just skip this check and rule other checks, like the enum.
The solution would be if we add check for empty: true as well, which skips other check if the value is ''.
Description
I do not know if this behaviour is by design or not but when I declare some prop like this one:
the validation process fails inferring that the empty value
''
is not in thestringEnum
, even if I've specified theoptional
and thenullable
features. Is this by design? Or shouldn't be the null and empty string, in this case, considered as part of the enumeration or checked before validating the enum? If so it should be documented or at least usingoptional
ornullable
withenum
should throw an exception...The text was updated successfully, but these errors were encountered: