Skip to content

Incorrect TypeScript to OpenApi enums mapping when stripping annotations #48

@ermakovich

Description

@ermakovich

First of all, thanks for cool package! It seems to work great compared to other similar packages. However I found one issue.

When using --strip-annotations flag it changes the way how enums are converted.

Given this typescript code:

export type Side = "left" | "right";

By default it converts to this YAML, which seems to be correct:

Side:
  enum:
    - left
    - right
  title: Side
  type: string

But when --strip-annotations flag is used, it get's converted to wrong anyOf format:

Side:
  anyOf:
    - enum:
        - left
      type: string
    - enum:
        - right
      type: string

When using --strip-annotations it's expected to not change the way how enums are converted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions