swagger-api / swagger-api/swagger-codegen

[Jaxrs] Compile error after generate jaxrs-cxf-client because of two InnerEnums

Open
#8,425 2 comments 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

I generated a jaxrs-cxf-client out of a Swagger JSON file. The JSON file contains two enums and after the generation both enums have the same name (InnerEnum) in the generated Java class which causes compile errors.

Swagger-codegen version

I used the current master branch (from July 13 2018).

Swagger declaration file content or url

I used the Swagger JSON file https://gist.github.com/andre-becker/e06aa56af6f641b18808cecac7abe190.

Command line used for generation

I used the command line:

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i https://gist.githubusercontent.com/andre-becker/e06aa56af6f641b18808cecac7abe190/raw/9900b435032b398bcda2ddd6451989330b5c8d0e/gistfile1.txt -l jaxrs-cxf-client
Steps to reproduce
  1. Clone swagger-codegen and build it:
git clone https://github.com/swagger-api/swagger-codegen
cd swagger-codegen
mvn clean package
  1. Generate the jaxrs-cxf-client using my JSON file (use the given link or copy/paste it to a local file from the link above):
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i https://gist.githubusercontent.com/andre-becker/e06aa56af6f641b18808cecac7abe190/raw/9900b435032b398bcda2ddd6451989330b5c8d0e/gistfile1.txt -l jaxrs-cxf-client
  1. Open the generated Java class Swaggerobject.java.

There are compile errors in the generated class (e.g. there are two enums with the name InnerEnum).

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

Reproduce the issue with the linked Swagger JSON, the jaxrs-cxf-client generator, and the provided Maven build and CLI command. Inspect the generated Swaggerobject.java and trace how the two enum declarations receive the same InnerEnum name. Done means the generated Java class uses distinct enum names and compiles without errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.