openapi-generator
openapi-generator copied to clipboard
[REQ] enhance useBeanValidation to generate @Valid for the returned objects too
Is your feature request related to a problem? Please describe.
We use openapi-generator-maven-plugin to generate interfaces for the REST clients, which we then create using RestClient, HttpServiceProxyFactory and org.springframework.aop.framework.ProxyFactory. With useBeanValidation=true this causes validation of the method parameters (because they are annotated @Valid in the generated interface), but it does not validate the response (because it is not annotated @Valid in the generated interface).
Describe the solution you'd like
Annotate the respones in the generated interfaces with @Valid, including the generic types (e.g. List<@Valid SomeType>).
Describe alternatives you've considered
Validate the responses using a custom code - this works, but it is a code which could be avoided.