Skip to content

Enum values not properly escaped #2614

@akoidan

Description

@akoidan

openapi-typescript version

7.12.0

Node.js version

20.x.x

OS + version

Archlinux

Description

When generating TypeScript types from OpenAPI specs, enum values containing backslashes (\) are not properly escaped in the generated type unions.

Reproduction

OpenAPI spec:

{
  "enum": ["a", "b", "c", "\\", ...]
}

Generated output:

type Keys = 'a' | 'b' | 'c' | '\' | ...;

Expected result

type Keys = 'a' | 'b' | 'c' | '\\' | ...;

Required

  • My OpenAPI schema is valid and passes the Redocly validator (npx @redocly/cli@latest lint)

Extra

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi-tsRelevant to the openapi-typescript library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions