Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1636 Fixes "blank" enums by providing the fallback name #1829

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lesha-co
Copy link

@lesha-co lesha-co commented Oct 12, 2023

Fixes issue #1636

Some frameworks (e.g. django rest framework, I guess) generate following schema:

openapi: 3.0.3
info:
    version: 1.0.0
components:
    schemas:
        BlankEnum:
            enum:
                - ''

right now this library generates invalid typescript:

export enum BlankEnum {
     = '',
}

This happens in getEnum functions that don't check for invalid input (getEnum([''])) in our case.

I decided to give such enum values BLANK name so that generated files are correct

export enum BlankEnum {
    BLANK = '',
}

Not sure if it would be a better idea to just omit these values (I mean, the name says BlankEnum) but everything's better than broken syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant