spring generator validation annotations doesn't work
Bug Report Checklist
- [x] Have you provided a full/minimal spec to reproduce the issue?
- [x] Have you validated the input using an OpenAPI validator (example)?
- [x] Have you tested with the latest master to confirm the issue still exists?
- [x] Have you searched for related issues/PRs?
- [x] What's the actual output vs expected output?
- [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I am trying to generate spring code based on open-api spec version 3.0.1. When I run that project I noticed that sprin boot doesn't respect validation and it works like without validation.
openapi-generator version
5.2.1
OpenAPI declaration file content or url
https://gist.github.com/rajdippatel/1fa05a79f15bbcdd0b64c805973d9d13
Generation Details
openapi-generator-cli generate -g spring -i specs.yaml -o out/spring/openapi
Steps to reproduce
- Generate spring code based on specs.yaml and above config
- Once spring will be generated run code
- You will see /auth/login will be executed even if required attributes are present
Related issues/PRs
-
None
-
Suggest a fix
-
Enable performBeanValidation or useBeanValidation. But if I enable it I can see it injects "hibernate-validation" package and it fails to build project.
-
If I add hibernate-validation in pom dependency, project compiles but still validation doesn't work
Hi Rajdip,
I tried replicating the issue and it seems the javax.validation.constraints.* is not effective in the generated code. Did you try generating any other validation and see if it works?
I had a similar issue. This fixed it