typeconv icon indicating copy to clipboard operation
typeconv copied to clipboard

Incorrect TypeScript to OpenApi enums mapping when stripping annotations

Open ermakovich opened this issue 1 year ago • 0 comments

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.

ermakovich avatar Jan 22 '25 18:01 ermakovich