Skip to content
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

Option to show full display name or not in error message #28

Open
typerandom opened this issue May 16, 2015 · 2 comments
Open

Option to show full display name or not in error message #28

typerandom opened this issue May 16, 2015 · 2 comments
Labels

Comments

@typerandom
Copy link
Owner

We should add an option of whether to use the full display name or not in the error message. This because in some cases showing the full display name makes the errors less user friendly. Especially if they are being shown to non developers. Also not having this option makes it troublesome if one would like to use a custom display name using SetDisplayNameTag(tagName).

Suggestion
defaultValidator := validator.Default()
defaultValidator.UseFullDisplayNameInError(false) // default is true
@typerandom typerandom changed the title Option to only full display name or not in error message Option to show full display name or not in error message May 16, 2015
@anh
Copy link

anh commented Jul 8, 2015

Structs often already have json tags, I think it is useful to have an option to pick json tags if any as display names and tagName in SetDisplayNameTag will be used in case there're both options.

@typerandom
Copy link
Owner Author

Yes, that is a good idea. Though I wonder if it's just easier if SetDisplayNameTag would accept an array and that would indicate the order in which display name tags would be read. I.e:

validator.SetDisplayNameTags([]string{"name", "json"})

Where the "name" would be read first, then if that doesn't exist, "json" after that, aso.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants