We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4a92b34 commit 88740b6Copy full SHA for 88740b6
src/swaggerToTS.js
@@ -49,9 +49,14 @@ const buildTypes = (spec, options) => {
49
const buildNextEnum = ([ID, options]) => {
50
output.push(`enum ${ID} {`);
51
options.forEach(option => {
52
- const name =
53
- typeof option === 'string' ? capitalize(camelCase(option)) : option;
54
- output.push(`${name} = ${JSON.stringify(option)},`);
+ if (typeof option === 'number') {
+ const lastWord = ID.search(/[A-Z](?=[^A-Z]*$)/);
+ const name = ID.substr(lastWord, ID.length);
55
+ output.push(`${name}${option} = ${option},`);
56
+ } else {
57
+ const name = capitalize(camelCase(option));
58
+ output.push(`${name} = ${JSON.stringify(option)},`);
59
+ }
60
});
61
output.push('}');
62
};
0 commit comments