-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add link to offending fields in case of validation failure #7
Comments
This makes sense. Do you have an example of what the structured error output should look like? |
Hi, thanks for a quick reply. Well I suggest something simple, like:
So nothing crazy, just a way to get messages out based on field keys. |
You caught me at a good time. I'll put something together over the next few days. I'm thinking about making your solution more of the default, and then providing a helper function that turns the error object into a human readable version. |
Makes sense. |
Would also love to have field name in errors array. And possibly hide field values in error messages. |
Any updates? |
Hi,
the lib is good, but the error output it produces are strings, and not some structure like in Ecto's Changeset, from which the errors for the offending fields can be extracted.
So the issue is the use of your library forces you to have external API (as an example of use) where all the validation messages are just strings, without a key (field name), so they are difficult to use by the client of such an API.
Maybe you could add another
valid?
function that would return more details about the field which caused the error, so that it can be better formatted by the user of the library?The text was updated successfully, but these errors were encountered: