OpenAPITools / OpenAPITools/openapi-generator

[BUG][JAVA][NATIVE] useEnumCaseInsensitive option not working for Enum Classes (Works for inner classes)

Open
#18,761 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

Changes made for default modelEnum template is missing in the native library. Therefore, fromValue method of enum classes always run as case sensitive even if useEnumCaseInsensitive option is enabled.

Default modelEnum.mustache:
https://github.com/OpenAPITools/openapi-generator/blob/746961d07a9048e4ea6ee09c4ea25100b4def065/modules/openapi-generator/src/main/resources/Java/modelEnum.mustache#L57-L67

Native Library's modelEnum.mustache:
https://github.com/OpenAPITools/openapi-generator/blob/746961d07a9048e4ea6ee09c4ea25100b4def065/modules/openapi-generator/src/main/resources/Java/libraries/native/modelEnum.mustache#L57-L67

openapi-generator version

7.6.0

OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Copy the lines #L57-L67 in modules/openapi-generator/src/main/resources/Java/modelEnum.mustache to lines #L57-L67 in modules/openapi-generator/src/main/resources/Java/libraries/native/modelEnum.mustache

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

Compare lines 57–67 of modules/openapi-generator/src/main/resources/Java/modelEnum.mustache with the corresponding section in modules/openapi-generator/src/main/resources/Java/libraries/native/modelEnum.mustache. Apply the same template change to the native library and verify that generated enum classes honor useEnumCaseInsensitive in fromValue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.