You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A brief description of the bug.
When generating enum values there is a possibility of name collision. For example, if an enum contains a list of timezone values, there may be collisions due to use of + and -.
Sample enum:
description: The default time zone setting for this entity.
type: string
example: America/New_York
enum:
- Africa/Abidjan
- Africa/Accra
- Etc/GMT
- Etc/GMT+0
- Etc/GMT+1
- Etc/GMT-1
this will result in a duplicate identifer being outputted:
Etc_GMT_1 = "Etc/GMT+1",
Etc_GMT_1 = "Etc/GMT-1",
Name
Version
openapi-typescript
7.3.0
Node.js
v18.20.4
OS + version
macOS 14.6.1
Reproduction
How can this be reproduced / when did the error occur?
Expected result
There should be no duplicated enums. One approach would be to surround in quotes if a special character is detected instead of replacing all special characters with _, or can have different replacement logic (e.g. + -> plus)
(in case it’s not obvious)
Checklist
My OpenAPI schema passes the Redocly validator (npx @redocly/cli@latest lint)
Description
A brief description of the bug.
When generating enum values there is a possibility of name collision. For example, if an enum contains a list of timezone values, there may be collisions due to use of + and -.
Sample enum:
this will result in a duplicate identifer being outputted:
openapi-typescript
7.3.0
v18.20.4
macOS 14.6.1
Reproduction
How can this be reproduced / when did the error occur?
Expected result
There should be no duplicated enums. One approach would be to surround in quotes if a special character is detected instead of replacing all special characters with
_
, or can have different replacement logic (e.g. + -> plus)(in case it’s not obvious)
Checklist
npx @redocly/cli@latest lint
)The text was updated successfully, but these errors were encountered: