grantila / grantila/typeconv

Incorrect TypeScript to OpenApi enums mapping when stripping annotations

Open
#48 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
447
Forks
10
PR merge metrics
No merged PRs in 30d

Description

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:

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

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

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

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

```yaml
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.