swagger-codegen-generators icon indicating copy to clipboard operation
swagger-codegen-generators copied to clipboard

Property enumPropertyNaming is missing in swagger v3 generator options

Open ugrave opened this issue 1 year ago • 0 comments

In Swagger v2 there is a typescript language option to configure the enum name handling: enumPropertyNaming, This options does not exist anymore in the v3 version.

My enum name contains an _ in the name which i want also have in the typescript enum name. That why i configure the enumPropertyNaming=original

In Swagger v3 this _ will now be removed:

Example api json:

"components": {
  "schemas": {
      "Example": {
        "type": "string",
        "enum": [
          "CONST_NAME"
        ]
      }
   }
}

Actual:

export type Example = "CONST_NAME"
export const Example = {
    CONSTNAME: 'CONST_NAME' as Example
}

Expected (with enumPropertyNaming=original):

export type Example = "CONST_NAME"
export const Example = {
    CONST_NAME: 'CONST_NAME' as Example
}

See commit from v2 which adds this option: https://github.com/swagger-api/swagger-codegen/commit/a4e5eb732ae2d582013bfb75e1043bab54a19f04

ugrave avatar Jul 18 '23 08:07 ugrave