swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.96k stars 6.04k forks source link

[Java] swagger-codegen-maven-plugin 2.3.1 not generate @valid annotations #8200

Open felixvolz opened 6 years ago

felixvolz commented 6 years ago
Description

Im using java/ swagger-codegen-maven-plugin 2.3.1 with the follwoing settings. I see my swagger constraints being generated, but dont see @valid tag being added per https://github.com/swagger-api/swagger-codegen/issues/5498

`

generate
                    <id>serviceability-generate-sources</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <output>${project.build.directory}</output>
                        <inputSpec>src/main/resources/swagger/api.yaml</inputSpec>
                        <language>jaxrs-cxf</language>
                        <configHelp></configHelp>         <configOptions>
                            <sourceFolder>generated</sourceFolder>
                            <dateLibrary>java8</dateLibrary>
                            <apiPackage>com.test.api</apiPackage>
                            <modelPackage>com.test.api.model</modelPackage>
                            <useBeanValidation>true</useBeanValidation>
                        <performBeanValidation>true</performBeanValidation>
                        </configOptions>
                    </configuration>
                </execution>`

Question: How do I trigger generation of @valid code per issues/5498

Swagger-codegen version
io.swagger
            <artifactId>swagger-codegen-maven-plugin</artifactId>
            <version>2.31</version>
Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
umabal commented 6 years ago

Hi, Could you please let me know if the above issue is fixed or not? Thanks Uma

dacloutier commented 5 years ago

I`m having the same issue. Would love to know if there is a workaround.

hleb-kastseika commented 4 years ago

I faced with the same issue in swagger-codegen-maven-plugin v3.0.16 for jaxrs-jersey. It don't generate @Valid annotation, due to that the cascade bean validation is broken. Are there any workarounds for the issue? @umabal, @dacloutier did you have a chance to solve or to workaround that finally?