openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[Java][Jersey] Add support for BeanValidation @Valid annotation

Open fuj1g0n opened this issue 8 years ago • 2 comments

Description

Java Jersey generator has same issue with https://github.com/swagger-api/swagger-codegen/issues/4738 (fixed by https://github.com/swagger-api/swagger-codegen/pull/7807 for jaxrs-cxf)

Without @Valid, constraint annotations will not be evaluated. So we need to add not only constraint annotations such as @NotNull, but also @Valid.

openapi-generator version

current master (2d99836e9047d74e958910aca1aa38b34e584daa)

OpenAPI declaration file content or url

N/A

Command line used for generation

N/A

Steps to reproduce

just read the generated sample.

Related issues/PRs
  • https://github.com/swagger-api/swagger-codegen/issues/4738
  • https://github.com/swagger-api/swagger-codegen/pull/7807
Suggest a fix/enhancement

https://github.com/fujigon/openapi-generator/commits/feature/java-jersey-validation-pojos

fuj1g0n avatar Sep 12 '18 07:09 fuj1g0n

Related issues/PRs

I think it was also reported here: https://github.com/swagger-api/swagger-codegen/issues/7651

jmini avatar Sep 13 '18 05:09 jmini

Thanks for your investigation. I read it and yes, the issue you told seems the same problem.

My understanding is that the problem is still exist both in openapi-generator and swagger-codegen. I already filed a PR to fix this problem to openapi-generator project.

https://github.com/OpenAPITools/openapi-generator/pull/1019 Could you kindly review it?

Thanks!

fuj1g0n avatar Sep 13 '18 09:09 fuj1g0n