swagger-api / swagger-api/swagger-codegen

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

Open
#11,184 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached Genesys Swagger 2.0 specification and the swagger-codegen-maven-plugin configuration, then run mvn clean install with version 3.0.27 and compare it with 3.0.7. Inspect the two extra generated files, including Schema.java and its swagger-annotations import. Done means the sample project builds successfully without the unexpected generated files.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.