@@ -22,9 +22,11 @@ static async Task<int> Main(string[] args)
2222 {
2323 // we assume the path are existed for simplicity.
2424 string path = Directory . GetCurrentDirectory ( ) ;
25- string csdl = path + "/../../../../../docs/csdl" ;
26- string oas20 = path + "/../../../../../docs/oas_2_0" ;
27- string oas30 = path + "/../../../../../docs/oas3_0_0" ;
25+ string parentPath = Path . Combine ( path , ".." , ".." , ".." , ".." , ".." ) ;
26+ string csdl = Path . Combine ( parentPath , "docs" , "csdl" ) ;
27+ string oas20 = Path . Combine ( parentPath , "docs" , "oas_2_0" ) ;
28+ string oas30 = Path . Combine ( parentPath , "docs" , "oas3_0_0" ) ;
29+ string oas31 = Path . Combine ( parentPath , "docs" , "oas3_1_0" ) ;
2830
2931 foreach ( var filePath in Directory . GetFiles ( csdl , "*.xml" ) )
3032 {
@@ -53,11 +55,14 @@ static async Task<int> Main(string[] args)
5355
5456 settings . EnableKeyAsSegment = true ;
5557 settings . EnableUnqualifiedCall = true ;
56- var output = oas30 + "/" + fileName + ".json" ;
58+ var output = Path . Combine ( oas31 , fileName + ".json" ) ;
5759 var document = model . ConvertToOpenApi ( settings ) ;
60+ await File . WriteAllTextAsync ( output , await document . SerializeAsJsonAsync ( OpenApiSpecVersion . OpenApi3_1 ) ) ;
61+
62+ output = Path . Combine ( oas30 , fileName + ".json" ) ;
5863 await File . WriteAllTextAsync ( output , await document . SerializeAsJsonAsync ( OpenApiSpecVersion . OpenApi3_0 ) ) ;
5964
60- output = oas20 + "/" + fileName + ".json" ;
65+ output = Path . Combine ( oas20 , fileName + ".json" ) ;
6166 await File . WriteAllTextAsync ( output , await document . SerializeAsJsonAsync ( OpenApiSpecVersion . OpenApi2_0 ) ) ;
6267
6368 Console . WriteLine ( "Output [ " + fileName + " ] Successful!" ) ;
0 commit comments