@@ -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
@@ -82,7 +83,7 @@ def __init__(
82
83
)
83
84
84
85
self .project_name : str = config .project_name_override or f"{ utils .kebab_case (openapi .title ).lower ()} -client"
85
- self .project_dir : Path = Path .cwd ()
86
+ self .project_dir : Path = Path .cwd () if output_path is None else Path ( output_path ). absolute ()
86
87
if meta != MetaType .NONE :
87
88
self .project_dir /= self .project_name
88
89
@@ -309,6 +310,7 @@ def _get_project_for_url_or_path( # pylint: disable=too-many-arguments
309
310
config : Config ,
310
311
custom_template_path : Optional [Path ] = None ,
311
312
file_encoding : str = "utf-8" ,
313
+ output_path : Optional [Path ] = None ,
312
314
) -> Union [Project , GeneratorError ]:
313
315
data_dict = _get_document (url = url , path = path , timeout = config .http_timeout )
314
316
if isinstance (data_dict , GeneratorError ):
@@ -322,6 +324,7 @@ def _get_project_for_url_or_path( # pylint: disable=too-many-arguments
322
324
meta = meta ,
323
325
file_encoding = file_encoding ,
324
326
config = config ,
327
+ output_path = output_path
325
328
)
326
329
327
330
@@ -333,6 +336,7 @@ def create_new_client(
333
336
config : Config ,
334
337
custom_template_path : Optional [Path ] = None ,
335
338
file_encoding : str = "utf-8" ,
339
+ output_path : Optional [Path ] = None ,
336
340
) -> Sequence [GeneratorError ]:
337
341
"""
338
342
Generate the client library
@@ -347,6 +351,7 @@ def create_new_client(
347
351
meta = meta ,
348
352
file_encoding = file_encoding ,
349
353
config = config ,
354
+ output_path = output_path
350
355
)
351
356
if isinstance (project , GeneratorError ):
352
357
return [project ]
@@ -361,6 +366,7 @@ def update_existing_client(
361
366
config : Config ,
362
367
custom_template_path : Optional [Path ] = None ,
363
368
file_encoding : str = "utf-8" ,
369
+ output_path : Optional [Path ] = None ,
364
370
) -> Sequence [GeneratorError ]:
365
371
"""
366
372
Update an existing client library
@@ -375,6 +381,7 @@ def update_existing_client(
375
381
meta = meta ,
376
382
file_encoding = file_encoding ,
377
383
config = config ,
384
+ output_path = output_path
378
385
)
379
386
if isinstance (project , GeneratorError ):
380
387
return [project ]
0 commit comments