Skip to content

Broken/unexpected behavior for enum values with numbers in them #276

@rudism

Description

@rudism

When generating enums (without --union-enums), there are two things that can happen when there are numbers in the enum values:

  1. An enum value prefixed with underscore and a number will result in invalid code being generated. For example _123_ENUM_VALUE in the swagger enum will generate the name 123ENUMVALUE which is invalid typescript because it starts with a number. Expected name would probably be to keep _123_ENUM_VALUE on the typescript side as well.

  2. An enum value with numbers anywhere in it is has underscores stripped from the generated name (reminiscent of Underscores are omitted from enum keys #108). For example ENUM_123_VALUE in the swagger enum will generate the name ENUM123VALUE. Expected typescript name would be ENUM_123_VALUE with underscores intact because it's valid typescript as-is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions