Closed smackgg closed 2 years ago
I wonder why the code is string type but valid value is provided with number.
Joi.object({
code: Joi.number()
.valid([1, 2, 3])
.required(),
});
the same issue
@kenspirit number will be return true when use _.isEmpty https://github.com/lodash/lodash/issues/496
.isEmpty(null) // => true .isEmpty(undefined) // => true .isEmpty(true); // => true .isEmpty(false); // => true .isEmpty(1); // => true .isEmpty(0); // => true
Yes, I am considering that just now. It should be a more generic fix instead of just for number.
In fact, enum always number/string
In fact, enum always number/string
@smackgg Sometimes, we might want to set the field to be null
, empty string or 0.
According to the spec, enum
should be array with unique element value of any type.
I wonder if this filtering logic should be removed.
like this enum shouldn't be filtered