-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[JAVA] Path variable validation doesn't work #8296
Comments
|
I too face similar issue. |
OpenApi Generator doesn't have this issue. |
In my case the plugin won't generate the validation code for path Parameter if their schema is descripted through a ref, e.g.:
Won't generate the validation annotations, e.g. @SiZe(max=255)
The generator correctly generates the validation annotations in code. |
I also faced with the issue - when I described regular expression pattern for path parameter in OpenAPI, it's ignored by codegen. Any ideas how to solve it? |
Description
Hello, at the moment swagger-codegen has incomplete validation. Body of the request is validated normally, but path validation doesn't work at all.
The root cause of the problem is that controller (or controller interface) doesn't have annotation @validated. There is workaround if I extends controller directly, but then a need to repeat all parameters annotations to make it works.
Good decision for me is to use delegates, but then I can't manually add @validated annotation to controller bean.
Swagger-codegen version
2.3.1
Swagger declaration file content or url
swagger-codegen-maven plugin configuration
Suggest a fix/enhancement
Add @validated annotation to spring controller's moustache if useValidation flag is true
The text was updated successfully, but these errors were encountered: