In my project, we use api first design approach and we have some autocreated classes/interfaces as an output of openApi. I override a GET and a PUT method in this interface, then I send requests through those methods on Postman and/or swagger, I receive below errors in postman and console: { "timestamp": "2023-02-02T17:25:26.548 00:00", "status": 500, "error": "Internal Server Error", "path": "/con" }
and
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Size' validating type 'com.xxxxx.xxxxxx.swagger.model.ConDto$ProviderEnum'. Check configuration for 'provider'
After that I have created my manual HTTP methods in my controller, and they work correct. I really spent really long time on this, however I am still away from the solution. Please excuse me since I am a junior Java Spring Boot Developer.
I created replica HTTP methods and worked on them, they work correct, so I cant get why the one coming from Interface does not work.
CodePudding user response:
You can use @Size
annotation for string length min/max value. It can't be used for ProviderEnum
as exception message indicates.
https://docs.jboss.org/hibernate/validator/3.1/reference/en/html_single/