-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Label declaration on Joi objects shadows the name of attributes that fails to be validated in the error message.
Example:
Joi.object({color: Joi.string().regex(/#[0-9a-fA-F]{6}/)}).label("test");
If I post a payload with a color field wrongly formatted I get:
{
"statusCode": 400,
"error": "Bad Request",
"message": "child \"test\" fails because [\"test\" with value \"string\" fails to match the required pattern: /^[0-9A-Fa-f]{6}$/]",
"validation": {
"source": "payload",
"keys": [
"color"
]
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect