@@ -54,7 +54,7 @@ def _print_parser_error(e: GeneratorError, color: str) -> None:
54
54
typer .echo ()
55
55
56
56
57
- def handle_errors (errors : Sequence [GeneratorError ]) -> None :
57
+ def handle_errors (errors : Sequence [GeneratorError ], fail_on_warning : bool = False ) -> None :
58
58
"""Turn custom errors into formatted error messages"""
59
59
if len (errors ) == 0 :
60
60
return
@@ -91,7 +91,7 @@ def handle_errors(errors: Sequence[GeneratorError]) -> None:
91
91
err = True ,
92
92
)
93
93
94
- if error_level == ErrorLevel .ERROR :
94
+ if error_level == ErrorLevel .ERROR or fail_on_warning :
95
95
raise typer .Exit (code = 1 )
96
96
97
97
@@ -119,6 +119,7 @@ def generate(
119
119
meta : MetaType = _meta_option ,
120
120
file_encoding : str = typer .Option ("utf-8" , help = "Encoding used when writing generated" ),
121
121
config_path : Optional [pathlib .Path ] = CONFIG_OPTION ,
122
+ fail_on_warning : bool = False ,
122
123
) -> None :
123
124
"""Generate a new OpenAPI Client library"""
124
125
from . import create_new_client
@@ -145,7 +146,7 @@ def generate(
145
146
file_encoding = file_encoding ,
146
147
config = config ,
147
148
)
148
- handle_errors (errors )
149
+ handle_errors (errors , fail_on_warning )
149
150
150
151
151
152
@app .command ()
@@ -156,6 +157,7 @@ def update(
156
157
meta : MetaType = _meta_option ,
157
158
file_encoding : str = typer .Option ("utf-8" , help = "Encoding used when writing generated" ),
158
159
config_path : Optional [pathlib .Path ] = CONFIG_OPTION ,
160
+ fail_on_warning : bool = False ,
159
161
) -> None :
160
162
"""Update an existing OpenAPI Client library"""
161
163
from . import update_existing_client
@@ -182,4 +184,4 @@ def update(
182
184
file_encoding = file_encoding ,
183
185
config = config ,
184
186
)
185
- handle_errors (errors )
187
+ handle_errors (errors , fail_on_warning )
0 commit comments