As described in the documentation, the boolean check is not strict - all of these are valid:
Joi.validate(0, Joi.boolean());
Joi.validate(1, Joi.boolean());
Joi.validate('true', Joi.boolean());
Joi.validate('false', Joi.boolean());
All of these validate.
Would it be possible to have a boolean() and a strictBoolean(), where strictBoolean only validated if the value is true / false?
Joi.boolean().strict() ?
Ah, thanks!
Regards,
Rich
On 21 Jul 2016, 17:07 +0100, Nicolas Morel [email protected], wrote:
Joi.boolean().strict() ?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub (https://github.com/hapijs/joi/issues/954#issuecomment-234302372), or mute the thread (https://github.com/notifications/unsubscribe-auth/AA3XGXOu2UXC0Y53cezQKPA7lM4OkoPYks5qX5lfgaJpZM4JR9Jl).
Most helpful comment
Joi.boolean().strict()?