I am currently creating a rest app using Spring and React. I've created a custom validator, that checks if data provided by DTO are correct. That's why I've also implemented some custom annotations to be checked by the validator.
I would like to ask if it is a good idea to create an annotation, for instance, @Discipline, that provides sport discipline is included in a set of disciplines available in the database. This kind of approach involves invoking the method of DisicplineService in Validator instead of DisciplineController.
Is it a good idea? Should I perform this kind of validation only in the controller?
Thanks for all answers and feedback.
Aucun commentaire:
Enregistrer un commentaire