I've defined a Joi schema for a User with the following rules:
const userRules = Joi.object({
name: Joi.string().pattern(new RegExp('^[A-Za-zÁÉÍÓÚáéíóúãõÃÕâêôÂÊÔ ]+$')).required(),
email: Joi.string().email().required(),
password: Joi.string().min(8).max(40).required()
});
For authentication purposes, I need to validate only email
and password
, excluding name
. Is there a way to achieve this without creating a separate schema?