-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
featureNew functionality or improvementNew functionality or improvement
Description
In some cases it would be useful to override the validation message on a per-validator basis. As an example, it is currently difficult to meet application requirements for user-facing error messages that include regular expressions (which output the regular expression itself in the error message).
Not sure what the best API would be, but here's an example of what I'm trying to propose:
var message = '{{key}} must be a hex color code';
var schema = {
color: Joi.string().regex(/^#[a-fA-F0-9]{6}$/, { message: message ))
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement