OpenAPITools / OpenAPITools/openapi-generator

[BUG][aspnetcore] Wrong Enum definition

Open
#11,118 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

It creates the enum successfully. But then if there is a property that is a list of the enum, the generator tries to define the enum again.

openapi-generator version

5.3.0

OpenAPI declaration file content or url
components:
  schemas:
    Connection:
      description: Connection
      properties:
        id:
          maxLength: 80
          type: string
        name:
          maxLength: 80
          type: string
        outer_vlan_ethertypes:
          description: "The ethertype of the outer tag in hexadecimal notation."
          example:
            - "0x8100"
          items:
            default: "0x8100"
            enum:
              - "0x8100"
              - "0x88a8"
              - "0x9100"
            type: string
          type: array
      title: Connection
      type: object
Generation Details

image

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 ASP.NET Core generation using the OpenAPI declaration in the issue and inspect the generator's enum handling for the Connection schema. Trace why the inline array-item enum is defined again after the enum is created. Done means generation succeeds without a duplicate enum definition for this input.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, 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.