-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors: context.key is actually the label, not the key #1167
Comments
Honestly not trying to be snarky here, but I mean.. that's kind of the point of
|
@WesTyler I'm trying to convert Joi errors to something like {
"name": "\"Name\" is required",
"phone": "\"Phone\" is required"
} in order to display them in my HTML forms that have inputs with names: <input name="name">
<input name="phone"> How do you suggest I do that if Joi errors give me only labels that are different for every language? {
"Имя": "<translated message>",
"Телефон": "<translated message>"
} |
I noticed this a while ago and waited for someone to complain about it :) |
@Marsup What's the change? It looks like it is working as described in the docs, so is the "fix" to change the behavior altogether? |
The |
@Marsup Fixing a bug is not a breaking change, it's a fixing change. |
That makes sense 👍 Also, just realized I was conflating "override key name in error messages" with "override key name in context details"... Sorry mates haha. |
Good luck patching joi without making it a breaking change, unless you choose the dirty path of making |
Context
What are you trying to achieve or the steps to reproduce?
I need to get the key from the context, I expected
context.key
to be the key, but it turns out it's the label.Which result you had ?
What did you expect ?
This example on RunKit: https://runkit.com/57d675ee7580c314003cf648/58fe1d4fad401b00120f475a/branches/master
The text was updated successfully, but these errors were encountered: