openapi-typescript-codegen
openapi-typescript-codegen copied to clipboard
Fixes #1636 Fixes "blank" enums by providing the fallback name
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