-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
Unwrap a validator instance of specified type contained in SpringValidatorAdapter #37119
Unwrap a validator instance of specified type contained in SpringValidatorAdapter #37119
Conversation
Thanks, @zpavloudis. I've opened spring-projects/spring-framework#31137 for the test failure caused by the Framework upgrade. |
@zpavloudis there are several commits here that are unrelated to the validator unwrapping. Could you please try rebasing your changes on the HEAD of the main branch and force pushing? |
@wilkinsona Now I do understand this is not the place to ask the why's and how's of git rebase but I have
and when attempting to push to origin - not via the terminal but through intellij's push dialog the list still reports several unrelated commits, as if it wants to update the forked branch with all the latest commits adding my work on top of it. I can certainly try a force push but would this not lead to the same situation as before? |
You might need to do a |
2399ff6
to
fd16ae7
Compare
@wilkinsona Thank you for your feedback. looks like that's done it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the PR, @zpavloudis. I've left a few comments for your consideration. It would also be good to test the unwrapping. Would you like to do that by adding a few tests to ValidatorAdapterTests
?
...figure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapter.java
Outdated
Show resolved
Hide resolved
...figure/src/main/java/org/springframework/boot/autoconfigure/validation/ValidatorAdapter.java
Outdated
Show resolved
Hide resolved
…ringValidatorAdapter" See spring-projectsgh-37081.
Thank your for your feedback. I've opted for 1 test that runs through the I could be missing something so I remain open to suggestions. |
Thanks very much for making your first contribution to Spring Boot, @zpavloudis. I polished your changes a little bit:
|
Hi Spring boot team!
This PR attempts to close gh-37081 by implementing the unwrap method in
boot/autoconfigure/validation/ValidatorAdapter
provided by Spring'sSmartValidator
interface which was added in consequence to Spring's gh-31082.It has been tested against the sample project provided in gh-31082 and returns a Bad Request as long as the
@Validated
annotation is removed from class-level.However it appears that
boot.autoconfigure.validation.ValidationAutoConfigurationTests#methodValidationPostProcessorValidatorDependencyDoesNotTriggerEarlyInitialization
fails when building against latest Spring 6.1.0-SNAPSHOT logging multiple warnings ofI've taken the liberty in submitting this PR as the above test also fails when not having my changes incorporated, I am not sure whether this is deemed an issue in Spring or in Spring boot but I think it shows some resemblence to Spring's gh-24553.