I am using express-validator to validate user name and email while creating user, the name which has the following validation chain
body("name")
.notEmpty()
.withMessage("Name is required")
.isString()
.withMessage("Name must be string")
.isLength({ min: 3 })
.withMessage("User name must be at least 3 character long")
.isLength({ max: 30 })
.withMessage("User name must be less than 30 character")
.custom((value) => /^[a-zA-Zs]+$/.test(value))
.withMessage("Name only contain alphabetic characters")
gets validated when i call create api and i am not passing name field in the body, then according to express-validator it must goes through the whole chain and returns all the errors occur in validaion chain but, I am getting only three errors as
errors: [
{
type: 'field',
value: undefined,
msg: 'Name is required',
path: 'name',
location: 'body'
},
{
type: 'field',
value: undefined,
msg: 'Name must be string',
path: 'name',
location: 'body'
},
{
type: 'field',
value: undefined,
msg: 'User name must be at least 3 character long',
path: 'name',
location: 'body'
}
]
why it is not giving me all the errors.



