-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support Optional as a container in validation module #138
Comments
I'm going to need to do this on a current project and will likely start by forking the existing validation module. If I work it out, I'll post what I come up with back here. |
@ldaley you might want to look into this issue then: FasterXML/java-classmate#25 For your particular use-case, this should already have the desired effect (just as a workaround): @Size(min = 10)
Optional<String> someString; A similar feature had been requested for collections before, that led me to the topic of |
Hi Luke, I'm happy to let you know, that these kinds of validation annotations are now also supported on
It'll be included in the next release then. |
Here you go: release v4.15.0 is published. |
@CarstenWickner Thank you for the fast turnaround, and excellent library. |
As far as I can tell, Optional and the validation module don't play well together. The pattern for validated optionals is given here:
https://docs.jboss.org/hibernate/validator/5.2/reference/en-US/html/ch02.html#_with_literal_java_util_optional_literal
So effectively,
Should be interpreted as:
The text was updated successfully, but these errors were encountered: