swagger-api / swagger-api/swagger-codegen

Getting issue while generating java POJOs for ENUMs from swagger json

Open
#7,247 0 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

Getting issue while generating java POJOs for ENUMs from swagger json

Swagger-codegen version

2.2.3

Swagger declaration file content or url

"test_property": {
"type": "string",
"description": "Indicates the primary journey type for the application.",
"enum": [
"TEST_ONE",
"TEST_TWO",
"TEST_THREE",
]
},
generated POJO generating it as

ONE("TEST_ONE"),
TWO("TEST_TWO"),
THREE("TEST_THREE"),   

ideally it should be generated it as

TEST_ONE("TEST_ONE"),
TEST_TWO("TEST_TWO"),
TEST_THREE("TEST_THREE"),   
Command line used for generation

java

Steps to reproduce

generate with java

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 by reproducing issue 7247 with swagger-codegen 2.2.3, the supplied Swagger enum property, and the Java generator. Trace the Java POJO enum generation path and verify that the generated constants preserve TEST_ONE, TEST_TWO, and TEST_THREE rather than dropping their prefixes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
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.