Is it possible to add "Y" and "N" in boolean type cast? MLS & bunch of state tax record data often do "Y"
It doesn't look like it is supported currently based on the code for that to be converted (or for the Boolean to be configured to override the flags).
I'm sure your PR would be reviewed if you wanted to add a new set of values there, personally I'd love to see Boolean take some configuration like this:
var obj = Joi.object().keys({
enabled: Joi.boolean({
truthyStrings: ['yes', 'y', 'true'],
falseyStrings: ['no', 'n', 'false']
}).required();
});
My thoughts precisely. I think I'm going to make this a breaking change and accept configuration.
I'd go for an API like Joi.boolean().truthy(...).falsy(...), the standard being the current Joi.boolean().strict() (true/false).
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Most helpful comment
I'd go for an API like
Joi.boolean().truthy(...).falsy(...), the standard being the currentJoi.boolean().strict()(true/false).