-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
follow instructionsThe issue failed to follow instructions, try againThe issue failed to follow instructions, try again
Description
const schema = Joi.object().keys({
firstName: Joi.string().required(),
lastName: Joi.string().required(),
password: Joi.string().min(6).pattern(new RegExp('^[a-zA-Z0-9]{3,30}$')).required(),
email: Joi.string().email().required().custom(async (value, helpers)=>{
const emailExist = await User.find({ email: value })
if (!emailExist) {
return helper.message("Email already exist")
} else {
return true
}
}),
});
await schema.validateAsync(req.body, {abortEarly: false});
I have tried every possible way to make the above code work without using async but still doesn't work.
Any technical explanation on why JOi decides to support only sync custom validator
ahmedfarag1993, bnymn and marzuk-zarir
Metadata
Metadata
Assignees
Labels
follow instructionsThe issue failed to follow instructions, try againThe issue failed to follow instructions, try again