Skip to content

[BUG] Incorrect ENUM generation #19066

Closed
Closed
@Noed

Description

@Noed

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

ENUM is being generated with additional "_" character when there's a number on the ENUM name.

openapi-generator version

Issue started on 7.7.0, works fine on 7.7.6.

OpenAPI declaration file content or url

Example ENUM attribute in the YAML spec:

        myAttribute:
          description: this is a ENUM            
          type: string
          enum:
          - MOVE2STOCK
          - MOVE2SHELF
          - KEEP
Generation Details

Java 17, Gradle build.

Steps to reproduce

Add ENUM attribute to the spec that has numbers in the attribute name.
Generate java model using openapi generator 7.7.0.
Look into the source code generated, the ENUM attribute names will have an "_" after the number.

For example:

  public enum MyAttributeEnum {
    MOVE2_STOCK("MOVE2STOCK"),
    MOVE2_SHELF("MOVE2SHELF"),
    KEEP("KEEP"),
Related issues/PRs
Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions