-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Error on type argument constraint validation failure [SPR-15916] #20470
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
Comments
Matt Newman commented On further inspection, 4.3.10 works with Hibernate 5.2.5 ... maybe this is a Hibernate issue? |
Juergen Hoeller commented This looks like you're using Hibernate Validator 6.0 there... Could you check the specific version? (since "Hibernate" itself is ambigous between ORM and Validator) We generally only have Bean Validation 2.0 and Hibernate Validator 6.0 support in Spring Framework 5.0. That said, we could add some tolerance to 4.3.11 as well. |
Peter Hart commented I'm a colleague of Matt's looking at this issue also. This issue is definitely occurring with hibernate validator > 5.2.5 < 6.0. It also looks like the fix that has been used for validation 2.0 won't work for hibernate 5.3, as the path returned by hibernate in this case is subtly different from the one returned by hibernate 6.0/validation 2.0. The path being looked at in SpringValidatorAdapter::determineField is thingIds[0].<collection element>, whereas for 2.0 validation, if I'm understanding this correctly, it should be defined as thingIds[0].<list element>. Also, in hibernate 6.0, it looks like the final node in the path has kind 'CONTAINER_ELEMENT', whereas with hibernate 5.3 it's seems to have type PROPERTY, because validator 1.1 doesn't have/support the CONTAINER_ELEMENT kind. |
Juergen Hoeller commented Thanks for the insight. I guess we'll have to do some lenient sanity processing of the path, truncating any part starting with a "<" here. We'll also apply that to our 5.0 branch since it is still supposed to be compatible with Hibernate Validator 5.x as well. |
Juergen Hoeller commented I've revised the algorithm to ignore path elements starting with "<" in addition to selecting them by element kind 'property', making it compatible with Bean Validation 2.0 / Hibernate Validator 6.0 as well as HV5's variant of the feature there. This is available in master for 5.0 RC4 now, along with our general Bean Validation 2.0 story. For 4.3.11, I'll backport a variant that ignores a path as of the "<" part at least. This is just a Hibernate Validator specific feature outside of a fully supported Bean Validation generation there, but we should nevertheless be able to leniently handle it... tolerating HV5 as well as HV6's variant if we happen to encounter it at runtime. |
Still doesn't work with Spring |
Matt Newman opened SPR-15916 and commented
When using type argument constraints on a collection, if a validation failure occurs, a
NotReadablePropertyException
is thrown.The issues occurs with Spring 4.3.10 and Hibernate 5.3.5, but not with Spring 4.3.9 and Hibernate 5.2.5.
First noticed this when upgrading from Spring Boot 1.4.7 to 1.5.6.
A minimal reproduction is available at https://github.com/mdjnewman/spring-framework-issues/tree/master/SPR-15916.
The following error is thrown by
shouldRaise400IfNestedValidationFails
in the demo project:Affects: 4.3.10
Issue Links:
Referenced from: commits f944815, 26284ca
The text was updated successfully, but these errors were encountered: