@@ -56,6 +56,7 @@ def __init__(
56
56
config : Config ,
57
57
custom_template_path : Optional [Path ] = None ,
58
58
file_encoding : str = "utf-8" ,
59
+ output_path : Optional [Path ] = None ,
59
60
) -> None :
60
61
self .openapi : GeneratorData = openapi
61
62
self .meta : MetaType = meta
@@ -78,7 +79,7 @@ def __init__(
78
79
)
79
80
80
81
self .project_name : str = config .project_name_override or f"{ utils .kebab_case (openapi .title ).lower ()} -client"
81
- self .project_dir : Path = Path .cwd ()
82
+ self .project_dir : Path = Path .cwd () if output_path is None else Path ( output_path ). absolute ()
82
83
if meta != MetaType .NONE :
83
84
self .project_dir /= self .project_name
84
85
@@ -300,6 +301,7 @@ def _get_project_for_url_or_path( # pylint: disable=too-many-arguments
300
301
config : Config ,
301
302
custom_template_path : Optional [Path ] = None ,
302
303
file_encoding : str = "utf-8" ,
304
+ output_path : Optional [Path ] = None ,
303
305
) -> Union [Project , GeneratorError ]:
304
306
data_dict = _get_document (url = url , path = path )
305
307
if isinstance (data_dict , GeneratorError ):
@@ -313,6 +315,7 @@ def _get_project_for_url_or_path( # pylint: disable=too-many-arguments
313
315
meta = meta ,
314
316
file_encoding = file_encoding ,
315
317
config = config ,
318
+ output_path = output_path
316
319
)
317
320
318
321
@@ -324,6 +327,7 @@ def create_new_client(
324
327
config : Config ,
325
328
custom_template_path : Optional [Path ] = None ,
326
329
file_encoding : str = "utf-8" ,
330
+ output_path : Optional [Path ] = None ,
327
331
) -> Sequence [GeneratorError ]:
328
332
"""
329
333
Generate the client library
@@ -338,6 +342,7 @@ def create_new_client(
338
342
meta = meta ,
339
343
file_encoding = file_encoding ,
340
344
config = config ,
345
+ output_path = output_path
341
346
)
342
347
if isinstance (project , GeneratorError ):
343
348
return [project ]
@@ -352,6 +357,7 @@ def update_existing_client(
352
357
config : Config ,
353
358
custom_template_path : Optional [Path ] = None ,
354
359
file_encoding : str = "utf-8" ,
360
+ output_path : Optional [Path ] = None ,
355
361
) -> Sequence [GeneratorError ]:
356
362
"""
357
363
Update an existing client library
@@ -366,6 +372,7 @@ def update_existing_client(
366
372
meta = meta ,
367
373
file_encoding = file_encoding ,
368
374
config = config ,
375
+ output_path = output_path
369
376
)
370
377
if isinstance (project , GeneratorError ):
371
378
return [project ]
0 commit comments