swagger-api / swagger-api/swagger-codegen-generators

[Java] Enums are renamed - why??

Open
#1,075 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

Description

Enum values are renamed in generated Java classes - compared to what I write in the schema.

This "feature" was already reported several times (in the swagger-codegen project)

I found even a closed MR (in the swagger-codegen project at least)

My question first of all would be: why? Why was such a mechanism introduced at all?
What do I miss?? What is the benefit / intention by doing this?

Does anyone know the answer for this?

In DefaultCodegenConfig there is a method findCommonPrefixOfVars() which is used in Enums generation and at the end of the day leads to renaming Enums.
Since this thing is sitting in DefaultCodegenConfig although not verified maybe happening in other languages too not just Java. For Java it is there for sure.

Version

1.0.36-SNAPSHOT (current master - when I file this problem)

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 DefaultCodegenConfig.findCommonPrefixOfVars() and trace how it is used during Java enum generation. Compare the generated enum names with the schema values, then review the referenced swagger-codegen issues and pull request for the intended behavior. Done requires a documented decision about whether renaming is expected and a clearly scoped change or regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.