-
Notifications
You must be signed in to change notification settings - Fork 38k
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
Increase reusability of Validator
[SPR-15314]
#19877
Comments
We are considering a default method on the |
After a bit of back and forth, I'm introducing a |
Validator
[SPR-15314]
Daniel Gulyas opened SPR-15314 and commented
Quick summary
Hi!
It would be really cool if the Validator implementations could be reused at the Service level hassle-free.
It would be cool because:
Example scenario when that happens:
controller <-dto-> service
, at the controller-side the dto is validated with the ValidatorNow there's a possibility to reuse the Validator created for the controller at the service level, but for me it seems to involves quite a hassle, it would be nice to make that convenient.
Proposal
The namings for me seem to be a bit weak, they could handle suggestions I'm pretty sure.
For existing Validator implementations there's only need to extend this abstract class and it'll turn into a validator which is convenient to use at the service level, please see the attached java files, this might be a bit invasive although.
Follow-up
This is just an idea and i'm kinda new to Spring and to Java in general so the proposal will probably include foolish design mistakes, i looked it up and so far i haven't seen anything which would make reusing of these easy, please point it out if there's already some.
If that's cool to do and there's a consensus i could make a pr for this in the coming days.
Let me know what you think!
Attachments:
The text was updated successfully, but these errors were encountered: