I am making a Joi schema to validate the request query, the schema looks like this.
const validateSchema = Joi.object()
.keys({
'size': Joi
.string()
.regex(/^\d+$/)
.optional(),,
'from': Joi
.string()
.regex(/^\d+$/)
.optional(),
'searchparams': Joi
.string()
.optional()
.allow(''),
'active': '' // do this here
});
In the above schema, I want active
field can either be a string or a boolean value, how can I apply the Joi schema validation there ?