@@ -30,19 +30,22 @@ private static void CompareOpenApiInfo(string version, IList<Model> openApiInfoM
3030 var openApiErrors = new HashSet < string > ( ) ;
3131 newPathsAdded . Add ( "Module,Path,Method" ) ;
3232 openApiErrors . Add ( "Module,ApiPath,Method,From,To" ) ;
33- var filePath = FileHandler . GetDocsFolder ( ) ;
34- Console . WriteLine ( filePath ) ;
35- var combinedPath = filePath != null ? Path . Combine ( filePath , "openApiInfo" ) : null ;
36- var openAPiInfoPath = combinedPath != null ? Path . Combine ( combinedPath , version ) : null ;
37- var combinedErrorPath = openAPiInfoPath != null ? Path . Combine ( openAPiInfoPath , openApiFileError ) : null ;
38- if ( combinedErrorPath != null && File . Exists ( combinedErrorPath ) )
33+ var openApiFilePath = FileHandler . GetOpenApiFolder ( ) ;
34+ var docPath = FileHandler . GetDocFolder ( ) ;
35+ var openApiPath = openApiFilePath != null ? Path . Combine ( openApiFilePath , version ) : null ;
36+
37+ var combinedDocPath = docPath != null ? Path . Combine ( docPath , "OpenAPiInfo" ) : null ;
38+ var openApiInfoPath = combinedDocPath != null ? Path . Combine ( combinedDocPath , version ) : null ;
39+
40+ var errorPath = openApiInfoPath != null ? Path . Combine ( openApiInfoPath , openApiFileError ) : null ;
41+ if ( errorPath != null && File . Exists ( errorPath ) )
3942 {
40- File . WriteAllText ( combinedErrorPath , string . Empty ) ;
43+ File . WriteAllText ( errorPath , string . Empty ) ;
4144 }
42- if ( combinedPath != null )
45+ if ( openApiPath != null )
4346 {
4447 //Go through list of openapi files
45- foreach ( var file in Directory . GetFiles ( combinedPath ) )
48+ foreach ( var file in Directory . GetFiles ( openApiPath ) )
4649 {
4750 using ( var sr = new StreamReader ( file ) )
4851 {
@@ -112,17 +115,17 @@ private static void CompareOpenApiInfo(string version, IList<Model> openApiInfoM
112115 var options = new JsonSerializerOptions { WriteIndented = true } ;
113116 var json = JsonSerializer . Serialize ( models , options ) ;
114117 //Clear file first
115- File . WriteAllText ( $ "{ openAPiInfoPath } \\ { openApiInfoFile } ", string . Empty ) ;
118+ File . WriteAllText ( $ "{ openApiInfoPath } \\ { openApiInfoFile } ", string . Empty ) ;
116119 //then write to it with new content.
117- File . WriteAllText ( $ "{ openAPiInfoPath } \\ { openApiInfoFile } ", json ) ;
120+ File . WriteAllText ( $ "{ openApiInfoPath } \\ { openApiInfoFile } ", json ) ;
118121 }
119122 if ( openApiErrors . Count > 1 )
120123 {
121124 foreach ( var error in openApiErrors )
122125 {
123126 var errList = error . Split ( "," ) ;
124127 var report = $ "{ errList [ 0 ] } ,{ errList [ 1 ] } ,{ errList [ 2 ] } ,{ errList [ 3 ] } ,{ errList [ 4 ] } ";
125- File . AppendAllText ( $ "{ openAPiInfoPath } \\ { openApiFileError } ", report + Environment . NewLine ) ;
128+ File . AppendAllText ( $ "{ openApiInfoPath } \\ { openApiFileError } ", report + Environment . NewLine ) ;
126129 }
127130 }
128131
0 commit comments