Is it possible to validate that a boolean is true using Joi? I've tried using allow, valid and invalid without any luck.
1 Answer
Have you tried something like this:
var schema = Joi.boolean().invalid(false); Using that schema, the following all populate the error property:
Joi.validate(false, schema); Joi.validate('false', schema); Joi.validate('no', schema); Joi.validate('off', schema); Joi.validate(0, schema); 3