swagger-typescript-api
swagger-typescript-api copied to clipboard
Typescript enum generation fails with special characters
The following schema:
{
"enum": ["&&", "||"],
"type": "string"
}
is compiled to
export enum RuleChainingOperator {
Type = '&&',
Type = '||',
}
Use the x-enumNames
property.
{
"enum": ["&&", "||"],
"x-enumNames": ["AND", "OR"],
"type": "string"
}
compiles to
export enum RuleChainingOperator {
AND = '&&',
OR = '||',
}