@@ -54,7 +54,7 @@ def _print_parser_error(e: GeneratorError, color: str) -> None:
5454 typer .echo ()
5555
5656
57- def handle_errors (errors : Sequence [GeneratorError ]) -> None :
57+ def handle_errors (errors : Sequence [GeneratorError ], fail_on_warning : bool = False ) -> None :
5858 """Turn custom errors into formatted error messages"""
5959 if len (errors ) == 0 :
6060 return
@@ -91,7 +91,7 @@ def handle_errors(errors: Sequence[GeneratorError]) -> None:
9191 err = True ,
9292 )
9393
94- if error_level == ErrorLevel .ERROR :
94+ if error_level == ErrorLevel .ERROR or fail_on_warning :
9595 raise typer .Exit (code = 1 )
9696
9797
@@ -119,6 +119,7 @@ def generate(
119119 meta : MetaType = _meta_option ,
120120 file_encoding : str = typer .Option ("utf-8" , help = "Encoding used when writing generated" ),
121121 config_path : Optional [pathlib .Path ] = CONFIG_OPTION ,
122+ fail_on_warning : bool = False ,
122123) -> None :
123124 """Generate a new OpenAPI Client library"""
124125 from . import create_new_client
@@ -145,7 +146,7 @@ def generate(
145146 file_encoding = file_encoding ,
146147 config = config ,
147148 )
148- handle_errors (errors )
149+ handle_errors (errors , fail_on_warning )
149150
150151
151152@app .command ()
@@ -156,6 +157,7 @@ def update(
156157 meta : MetaType = _meta_option ,
157158 file_encoding : str = typer .Option ("utf-8" , help = "Encoding used when writing generated" ),
158159 config_path : Optional [pathlib .Path ] = CONFIG_OPTION ,
160+ fail_on_warning : bool = False ,
159161) -> None :
160162 """Update an existing OpenAPI Client library"""
161163 from . import update_existing_client
@@ -182,4 +184,4 @@ def update(
182184 file_encoding = file_encoding ,
183185 config = config ,
184186 )
185- handle_errors (errors )
187+ handle_errors (errors , fail_on_warning )
0 commit comments