I am using an OpenAPI3 schema generated by DRF-Spectecular for Django. In our swagger.json we have an Enum with an empty string value.
Our BlankEnum field on the schema:
"BlankEnum": {
"enum": [
""
]
},
This causes the generator to write faulty TS code:
error SyntaxError: Type expected. (5103:27)
> 5103 | export type BlankEnum = ;
| ^
My current fix is to change the template.ts to render an empty string with quotes and it seems to work, as the generator will do write an emtpy string with quotes in the generated TS code.
export function typeTemplate(name: string, typeString: string, prefix?: string) {
return `
export type ${name} = ${typeString || '""'};
`
}
If this change is acceptable feel free to merge, would be great. Keep up the good work and cheers.
Hi there,
I am using an OpenAPI3 schema generated by DRF-Spectecular for Django. In our swagger.json we have an Enum with an empty string value.
Our BlankEnum field on the schema:
This causes the generator to write faulty TS code:
My current fix is to change the template.ts to render an empty string with quotes and it seems to work, as the generator will do write an emtpy string with quotes in the generated TS code.
If this change is acceptable feel free to merge, would be great. Keep up the good work and cheers.