@@ -16,6 +16,7 @@ const params = program
1616 . option ( '--name <value>' , 'Custom client class name' )
1717 . option ( '--useOptions' , 'Use options instead of arguments' )
1818 . option ( '--useUnionTypes' , 'Use union types instead of enums' )
19+ . option ( '--autoformat' , 'Process generated files with autoformatter' , false )
1920 . option ( '--exportCore <value>' , 'Write core files to disk' , true )
2021 . option ( '--exportServices <value>' , 'Write services to disk' , true )
2122 . option ( '--exportModels <value>' , 'Write models to disk' , true )
@@ -29,6 +30,14 @@ const params = program
2930
3031const OpenAPI = require ( path . resolve ( __dirname , '../dist/index.js' ) ) ;
3132
33+ const parseBooleanOrString = value => {
34+ try {
35+ return JSON . parse ( value ) === true ;
36+ } catch ( error ) {
37+ return value ;
38+ }
39+ } ;
40+
3241if ( OpenAPI ) {
3342 OpenAPI . generate ( {
3443 input : params . input ,
@@ -37,9 +46,10 @@ if (OpenAPI) {
3746 clientName : params . name ,
3847 useOptions : params . useOptions ,
3948 useUnionTypes : params . useUnionTypes ,
49+ autoformat : JSON . parse ( params . autoformat ) === true ,
4050 exportCore : JSON . parse ( params . exportCore ) === true ,
41- exportServices : JSON . parse ( params . exportServices ) === true ,
42- exportModels : JSON . parse ( params . exportModels ) === true ,
51+ exportServices : parseBooleanOrString ( params . exportServices ) ,
52+ exportModels : parseBooleanOrString ( params . exportModels ) ,
4353 exportSchemas : JSON . parse ( params . exportSchemas ) === true ,
4454 indent : params . indent ,
4555 postfixServices : params . postfixServices ,
0 commit comments