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

Hibernate validator messages handling #136

Open
vankeisb opened this issue Sep 12, 2012 · 1 comment
Open

Hibernate validator messages handling #136

vankeisb opened this issue Sep 12, 2012 · 1 comment
Assignees
Labels

Comments

@vankeisb
Copy link
Member

The handling of the validator messages is not good. We have to bridge between Stripes and Validator (in HibernateValidateFacet), which causes parameter replacement issues.

Validator has its own message interpolation system, which doesn't work with indexed params but with named placeholders. Moreover it doesn't display the field name by default.

In <= 2.0.3 we try to translate the messages using a correspondency map for message templates. We locate the template in the Stripes resources (don't even care about the Validator messages) and try to pass the replacement params.
We have inconsistent behavior depending on the platform : the parameters are not passed in the same order to the message template. We actually pass map keys, an unordered set, so it's a real bug in our code.

We need to find a better system, by using the Validator messages instead of our owns.

@vankeisb
Copy link
Member Author

d0e6b21 fixed a few things :

  • no more Stripes<->Validator message keys
  • custom errors get added directly using the Validator messages

There is still a quirk : we do hard-coded concat of the field name and the message. I found no direct way to make Validator use the field name.

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

1 participant