cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
403 stars 134 forks source link

Enum serialization with negative values duplicates enum keys #335

Open bzh2610 opened 20 hours ago

bzh2610 commented 20 hours ago

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.