1
1
import argparse
2
+ import glob
2
3
import json
3
4
import os
4
5
import re
@@ -83,7 +84,7 @@ def generate(spec_folder: str, spec_files: List[str], output_path: str, language
83
84
84
85
85
86
def generate_domain_for_language (spec_file : str , config_path : str , spec_folder : str , output_path : str , language : str , parent_dir : str ) -> None :
86
- print ("generate domain for language: {}, config: {}, spec file: {}" .format (language , config_path , spec_file ))
87
+ print ("generate domain for language: {}, config: {}, spec folder: {}, file: {}" .format (language , config_path , spec_folder , spec_file ))
87
88
full_path = os .path .join (spec_folder , spec_file )
88
89
full_config_path = os .path .join (config_path , spec_file )
89
90
config = {
@@ -96,21 +97,23 @@ def generate_domain_for_language(spec_file: str, config_path: str, spec_folder:
96
97
}
97
98
# print(config)
98
99
with open (full_config_path , 'w' ) as f :
99
- f .write (json .dumps (config ))
100
+ f .write (json .dumps (config ) + " \n " )
100
101
101
102
def run_openapi_generator (parent_dir : Path , language : str ) -> None :
102
103
properties = "-DapiTests=false"
103
104
if language in {"node" , "python" }:
104
105
properties += " -DskipFormModel=false"
105
106
107
+ paths = glob .glob (os .path .join (CONFIG_FOLDER , language , "*" ))
108
+
106
109
command = [
107
110
"java" ,
108
111
* properties .split (), # Splits e.g. "-DapiTests=false -DskipFormModel=false" into separate arguments
109
112
"-cp" ,
110
113
"target/twilio-openapi-generator.jar" ,
111
114
"org.openapitools.codegen.OpenAPIGenerator" ,
112
115
"batch" ,
113
- f" { CONFIG_FOLDER } / { language } /*"
116
+ * paths ,
114
117
]
115
118
116
119
printable_cmd = " " .join (shlex .quote (arg ) for arg in command )
0 commit comments