Open manhp-codeleap opened 2 years ago
I suggest something like this: (add safe surroundEnum) for : 3 generators
const safeSurroundEnum = (item: string): string => {
if (item.indexOf("'") != -1) {
return surround('"', '"')(item);
}
return surround("'", "'")(item);
};
export const typeScriptGenerator: Generator = {
...
getTypeEnum: flow(map(safeSurroundEnum), getUnion),
...
};
eg: if enum contain single quote in it's body => when pass to prettier => it should be error
From openApi: eg: enum : [ "this is normal", "but this's why cause error" # => this will cause error on parser ]