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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Hibernate Validator #8016

Merged
merged 2 commits into from Nov 21, 2017
Merged

Conversation

mkurz
Copy link
Member

@mkurz mkurz commented Nov 17, 2017

It is now possible to specify constraints directly on the type argument of an Optional and on the type argument of a Map's key. Before that was "just" possible for Lists and the value of a Map.
To make this work I had to change a regex, just read the comment I put there (If we keep the regex as it is now, we would fail with an exception for Optional and Map). If you look at the test I renamed you should get what this all is about.

BTW: Upgrading to HV-6 lets us revert #7542 because https://hibernate.atlassian.net/browse/HV-1323 has been fixed 馃帀


public class ListForm {

@Valid
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Valid is not needed anymore for type argument validation. See https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#container-element-constraints

In versions prior to 6, a subset of container element constraints were supported. A @Valid annotation was required at the container level to enable them. This is not required anymore as of Hibernate Validator 6.

Copy link
Member

@marcospereira marcospereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mkurz maybe we should add this update to Highlights27?

@mkurz
Copy link
Member Author

mkurz commented Nov 21, 2017

Hmm, do you think this is necessary? It's just a library upgrade. You can validate things like List<@Constraints.Min(0) Integer> values already now with Play 2.6, HV 6 now allows that for Optional as well. I am not sure if it's worth to add that to the highlights. I mean Play itself didn't add any functionality. Also the docs clearly mention that Play uses Hibernate Validator and we even refer to the HV docs.
But if you insist I am ok to add a short section 馃槈

@marcospereira
Copy link
Member

Nah. I think we are ok then.

Thanks, @mkurz.

@marcospereira marcospereira merged commit 8e80755 into playframework:master Nov 21, 2017
@mkurz mkurz deleted the upgradeHV branch November 21, 2017 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants