-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Introduce ValidatingEntityCallback
and deprecate ValidatingMongoEventListener
#4901
Comments
Looking at our Bean Validation integration, MongoDB is the only module that ships with a Bean Validation integration. It is an extremely thin layer component that mandates a dependency on Bean Validation. For the upcoming major 5.0 version of Spring Data MongoDB, we could switch from registering a listerner into registering an EntityCallback. Let me take this ticket to the team to see what they think about it. |
ValidatingEntityCallback
and deprecate ValidatingMongoEventListener
After talking with the team, we'd happily accept a pull request. |
Cool @mp911de! One quick question regarding the implementation: Do you prefer a dedicated "callback-entity" class (not exist) and a dedicated "event-listener" class (already exisists) or is one validator class impementing both interfaces sufficent? If you prefer the "dedicated" classes option, I tend to put the validation logic in one abstract/base class and let the other classes extend from it. What do you think ? |
Answering the question myself: due to different Pls give me some time for preparing the pull request |
Hello,
I would like to contribute a
ValidatingEntityCallback
(in addition to theValidatingMongoEventListener
) to the code base.The
ValidatingMongoEventListener
is not suitable for me due to the design nature ofEventListener
andEntityCallback
. I preferEntityCallback
IMHO the
ValidatingMongoEventListener
should (even) be marked as deprecated, becauseEntityCallbacks
are recommended by the Spring docs andEventListener
are by design triggered/executed before anyEntityCallback
. This can lead to undesired behaviour difficult to track down by a developer, e.g. validation of entity happens before the entity in request is manipulated by anyEntityCallback
If the maintainers/team accept my enhancement proposal, I can make a pull request.
The text was updated successfully, but these errors were encountered: