Skip to content

Enum serialization with negative values duplicates enum keys #335

@bzh2610

Description

@bzh2610

I have an OpenAPI spec generated in JSON containing the following enum :

 "CustomType": {
   "enum": [0, 1, 2, 3, -1],
   "type": "integer",
   "format": "int32"
 },

If I check the custom typescript file generated, I get the following :

export enum CustomType {
  $0 = 0,
  $1 = 1,
  $2 = 2,
  $3 = 3,
  $1 = -1,
}

Which doesn't compile as we redeclare $1 twice.
Is there any workarround or configuration I missed ?

I can provide a code sandox if needed for reproduction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions