Manage validation errors in the body of requests
Whenever a validation error happens in the body of one of your requests, the same error message format will be returned:
{
"statusCode": 400,
"timestamp": "2024-07-12T05:59:48.327Z",
"path": "/api/auth/signin",
"errors": \[
{
"target": {},
"property": "email",
"children": \[],
"constraints": {
"isEmail": "email must be an email"
}
},
{
"target": {},
"property": "password",
"children": \[],
"constraints": {
"isLength": "password must be longer than or equal to 6 characters",
"matches": "password must match /^(?=._[a-z])(?=._[A-Z])(?=.\*[0-9])/ regular expression",
"isString": "password must be a string"
}
}
],
"message": "email must be an email",
"name": "REST_VALIDATION_ERROR"
}
In the errors array, you will find a list of all the keys for which the validation rules broke. Inside of the errors object, you will find under constraints the rule that must be respected.
Updated 14 days ago
What’s Next