You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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}}
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
lockbot
locked as resolved and limited conversation to collaborators
Jan 9, 2020
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
generates an validation error, all we know from the error is
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:The text was updated successfully, but these errors were encountered: