@@ -33,29 +33,20 @@ program
33
33
)
34
34
. option (
35
35
"-r, --responses" ,
36
- "generate additional information about request responses\n" +
37
- "also add typings for bad responses" ,
36
+ "generate additional information about request responses\n" + "also add typings for bad responses" ,
38
37
false ,
39
38
)
40
39
. option ( "--union-enums" , 'generate all "enum" types as union types (T1 | T2 | TN)' , false )
41
40
. option ( "--route-types" , "generate type definitions for API routes" , false )
42
41
. option ( "--no-client" , "do not generate an API class" , false )
43
- . option (
44
- "--enum-names-as-values" ,
45
- "use values in 'x-enumNames' as enum values (not only as keys)" ,
46
- false ,
47
- )
42
+ . option ( "--enum-names-as-values" , "use values in 'x-enumNames' as enum values (not only as keys)" , false )
48
43
. option (
49
44
"--extract-request-params" ,
50
45
"extract request params to data contract (Also combine path params and query params into one object)" ,
51
46
false ,
52
47
)
53
48
. option ( "--extract-request-body" , "extract request body type to data contract" , false )
54
- . option (
55
- "--modular" ,
56
- "generate separated files for http client, data contracts, and routes" ,
57
- false ,
58
- )
49
+ . option ( "--modular" , "generate separated files for http client, data contracts, and routes" , false )
59
50
. option ( "--js" , "generate js api module with declaration file" , false )
60
51
. option (
61
52
"--module-name-index <number>" ,
@@ -72,11 +63,7 @@ program
72
63
. option ( "--default-response <type>" , "default type for empty response schema" , TS_KEYWORDS . VOID )
73
64
. option ( "--type-prefix <string>" , "data contract name prefix" , "" )
74
65
. option ( "--type-suffix <string>" , "data contract name suffix" , "" )
75
- . option (
76
- "--clean-output" ,
77
- "clean output folder before generate api. WARNING: May cause data loss" ,
78
- false ,
79
- )
66
+ . option ( "--clean-output" , "clean output folder before generate api. WARNING: May cause data loss" , false )
80
67
. option ( "--patch" , "fix up small errors in the swagger source definition" , false ) ;
81
68
82
69
program . parse ( process . argv ) ;
@@ -140,4 +127,9 @@ generateApi({
140
127
typePrefix,
141
128
typeSuffix,
142
129
patch : ! ! patch ,
130
+ } ) . catch ( ( err ) => {
131
+ // NOTE collect all errors on top level and shows to users in any case
132
+ console . error ( err ) ;
133
+
134
+ process . exit ( 1 ) ;
143
135
} ) ;
0 commit comments