Issue
I have a REST API defined in a swagger.yaml. Inside there are all the fields with their specifications (eg: length, pattern, etc.). Is there a way in java to validate these fields according to their specifications without having to do it manually?
Solution
In this way I should go and set the annotation manually above each field, I was looking for a library that would automate everything by reading the rules on the swagger
Yes, the OpenApi tool generator is able to do that.
https://openapi-generator.tech/docs/generators/jaxrs-spec
If the option "useBeanValidation" is enabled (default value), then the javax.validation annotations will be generated in your jaxrs bean.
Answered By - TacheDeChoco