File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @manifoldco/swagger-to-ts" ,
3- "version" : " 0.2.0 " ,
3+ "version" : " 0.2.1 " ,
44 "description" : " Convert Swagger files to TypeScript" ,
55 "main" : " dist/swaggerToTS.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -49,9 +49,14 @@ const buildTypes = (spec, options) => {
4949 const buildNextEnum = ( [ ID , options ] ) => {
5050 output . push ( `enum ${ ID } {` ) ;
5151 options . forEach ( option => {
52- const name =
53- typeof option === 'string' ? capitalize ( camelCase ( option ) ) : option ;
54- output . push ( `${ name } = ${ JSON . stringify ( option ) } ,` ) ;
52+ if ( typeof option === 'number' ) {
53+ const lastWord = ID . search ( / [ A - Z ] (? = [ ^ A - Z ] * $ ) / ) ;
54+ 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+ }
5560 } ) ;
5661 output . push ( '}' ) ;
5762 } ;
You can’t perform that action at this time.
0 commit comments