0

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 ?

  • 1
    Does this answer your question? [Multiple Joi validation types](https://stackoverflow.com/questions/41468779/multiple-joi-validation-types) – Konrad Jul 04 '22 at 12:51

0 Answers0