-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
featureNew functionality or improvementNew functionality or improvement
Milestone
Description
It would be helpful for constructing error messages (outside of Joi) to have the context for each error in the details array. For example, if
{
length: Joi.number().min(3)
}generates an validation error, all we know from the error is
{
message: "length must be larger than or equal to 3",
path: "length",
type: "number.min"
}If I want to pass the error to a separate localization library (that doesn't use the {{ key }} format) it's difficult to extract the min limit, but that information is present if we add the context to the detail object:
{
message: "length must be larger than or equal to 3",
path: "length",
type: "number.min",
context: {
key: "length",
limit: 3
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement