Joi's allow('') has been used to combat string() not accepting ''. But that seems to not be taking into account a required object property, for which an empty string as a value should mean empty the same way as an undefined.
Even if it's a matter of preference, there's no meaningful way to describe the criteria. Possibly "minLength": "x" would be a workaround.
On the other hand, it is still possible to require a prop but allow '', which has already been covered as a unit test which continues to pass.
Joi's
allow('')
has been used to combatstring()
not accepting''
. But that seems to not be taking into account a required object property, for which an empty string as a value should mean empty the same way as an undefined.Even if it's a matter of preference, there's no meaningful way to describe the criteria. Possibly
"minLength": "x"
would be a workaround.On the other hand, it is still possible to require a prop but allow
''
, which has already been covered as a unit test which continues to pass.