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.98k stars 6.03k forks source link

Latest version 3.0.27 of swagger-codegen-plugin generates 2 additional files which is breaking the build #11184

Open samirshaik opened 3 years ago

samirshaik commented 3 years ago
Description

For swagger files (spec : 2.0) provided by one of our vendor Genesys, the build is failing with newer version of io.swagger.codegen.v3 : swagger-codegen-plugin : 3.0.27.

The reason for failure is that there are 2 additional files that are being generated, one being named "Schema.java". In this file there is import of io.swagger.v3.oas.annotations.media.Schema which comes from swagger-annotations library.

Sample maven project has been attached in the comments section. Just change swagger-codegen-maven-plugin version to 3.0.7 and notice that the project builds without any problems.

JDK: 1.8

For JDK 11, you need to add following dependency.

javax javaee-api 8.0 provided
Swagger-codegen version

3.0.27

Swagger declaration file content or url

Attached in the comments section.

Command line used for generation
<plugin>
                <groupId>io.swagger.codegen.v3</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <executions> 
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <id>1</id>
                        <configuration>
                            <inputSpec>${project.basedir}/src/main/schema/yaml/genesys.yaml</inputSpec>
                            <language>java</language>
                            <configOptions>
                                <sourceFolder>src/gen/java/main/genesys</sourceFolder>
                            </configOptions>
                            <apiPackage>api</apiPackage>
                            <modelPackage>model.genesys</modelPackage>
                            <invokerPackage>invoker</invokerPackage>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
Steps to reproduce

mvn clean install

Related issues/PRs
Suggest a fix/enhancement
samirshaik commented 3 years ago

swagger-test.zip