@@ -41,7 +41,7 @@ internal static class OpenApiService
4141 /// <summary>
4242 /// Implementation of the transform command
4343 /// </summary>
44- public static async Task TransformOpenApiDocument ( HidiOptions options , ILogger logger , CancellationToken cancellationToken = default )
44+ public static async Task TransformOpenApiDocumentAsync ( HidiOptions options , ILogger logger , CancellationToken cancellationToken = default )
4545 {
4646 if ( string . IsNullOrEmpty ( options . OpenApi ) && string . IsNullOrEmpty ( options . Csdl ) && string . IsNullOrEmpty ( options . FilterOptions ? . FilterByApiManifest ) )
4747 {
@@ -70,7 +70,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l
7070 var openApiVersion = options . Version != null ? TryParseOpenApiSpecVersion ( options . Version ) : OpenApiSpecVersion . OpenApi3_0 ;
7171
7272 // If ApiManifest is provided, set the referenced OpenAPI document
73- var apiDependency = await FindApiDependency ( options . FilterOptions . FilterByApiManifest , logger , cancellationToken ) . ConfigureAwait ( false ) ;
73+ var apiDependency = await FindApiDependencyAsync ( options . FilterOptions . FilterByApiManifest , logger , cancellationToken ) . ConfigureAwait ( false ) ;
7474 if ( apiDependency != null )
7575 {
7676 options . OpenApi = apiDependency . ApiDescripionUrl ;
@@ -80,12 +80,12 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l
8080 JsonDocument ? postmanCollection = null ;
8181 if ( ! string . IsNullOrEmpty ( options . FilterOptions ? . FilterByCollection ) )
8282 {
83- using var collectionStream = await GetStream ( options . FilterOptions . FilterByCollection , logger , cancellationToken ) . ConfigureAwait ( false ) ;
83+ using var collectionStream = await GetStreamAsync ( options . FilterOptions . FilterByCollection , logger , cancellationToken ) . ConfigureAwait ( false ) ;
8484 postmanCollection = await JsonDocument . ParseAsync ( collectionStream , cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
8585 }
8686
8787 // Load OpenAPI document
88- var document = await GetOpenApi ( options , logger , options . MetadataVersion , cancellationToken ) . ConfigureAwait ( false ) ;
88+ var document = await GetOpenApiAsync ( options , logger , options . MetadataVersion , cancellationToken ) . ConfigureAwait ( false ) ;
8989
9090 if ( options . FilterOptions != null )
9191 {
@@ -116,7 +116,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l
116116 }
117117 }
118118
119- private static async Task < ApiDependency ? > FindApiDependency ( string ? apiManifestPath , ILogger logger , CancellationToken cancellationToken = default )
119+ private static async Task < ApiDependency ? > FindApiDependencyAsync ( string ? apiManifestPath , ILogger logger , CancellationToken cancellationToken = default )
120120 {
121121 ApiDependency ? apiDependency = null ;
122122 // If API Manifest is provided, load it, use it get the OpenAPI path
@@ -130,7 +130,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l
130130 {
131131 apiDependencyName = apiManifestRef [ 1 ] ;
132132 }
133- using ( var fileStream = await GetStream ( apiManifestRef [ 0 ] , logger , cancellationToken ) . ConfigureAwait ( false ) )
133+ using ( var fileStream = await GetStreamAsync ( apiManifestRef [ 0 ] , logger , cancellationToken ) . ConfigureAwait ( false ) )
134134 {
135135 var document = await JsonDocument . ParseAsync ( fileStream , cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
136136 apiManifest = ApiManifestDocument . Load ( document . RootElement ) ;
@@ -212,7 +212,7 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma
212212 }
213213
214214 // Get OpenAPI document either from OpenAPI or CSDL
215- private static async Task < OpenApiDocument > GetOpenApi ( HidiOptions options , ILogger logger , string ? metadataVersion = null , CancellationToken cancellationToken = default )
215+ private static async Task < OpenApiDocument > GetOpenApiAsync ( HidiOptions options , ILogger logger , string ? metadataVersion = null , CancellationToken cancellationToken = default )
216216 {
217217 OpenApiDocument document ;
218218 Stream stream ;
@@ -223,7 +223,7 @@ private static async Task<OpenApiDocument> GetOpenApi(HidiOptions options, ILogg
223223 using ( logger . BeginScope ( "Convert CSDL: {Csdl}" , options . Csdl ) )
224224 {
225225 stopwatch . Start ( ) ;
226- stream = await GetStream ( options . Csdl , logger , cancellationToken ) . ConfigureAwait ( false ) ;
226+ stream = await GetStreamAsync ( options . Csdl , logger , cancellationToken ) . ConfigureAwait ( false ) ;
227227 Stream ? filteredStream = null ;
228228 if ( ! string . IsNullOrEmpty ( options . CsdlFilter ) )
229229 {
@@ -233,15 +233,15 @@ private static async Task<OpenApiDocument> GetOpenApi(HidiOptions options, ILogg
233233 await stream . DisposeAsync ( ) . ConfigureAwait ( false ) ;
234234 }
235235
236- document = await ConvertCsdlToOpenApi ( filteredStream ?? stream , metadataVersion , options . SettingsConfig , cancellationToken ) . ConfigureAwait ( false ) ;
236+ document = await ConvertCsdlToOpenApiAsync ( filteredStream ?? stream , metadataVersion , options . SettingsConfig , cancellationToken ) . ConfigureAwait ( false ) ;
237237 stopwatch . Stop ( ) ;
238238 logger . LogTrace ( "{Timestamp}ms: Generated OpenAPI with {Paths} paths." , stopwatch . ElapsedMilliseconds , document . Paths . Count ) ;
239239 }
240240 }
241241 else if ( ! string . IsNullOrEmpty ( options . OpenApi ) )
242242 {
243- stream = await GetStream ( options . OpenApi , logger , cancellationToken ) . ConfigureAwait ( false ) ;
244- var result = await ParseOpenApi ( options . OpenApi , options . InlineExternal , logger , stream , cancellationToken ) . ConfigureAwait ( false ) ;
243+ stream = await GetStreamAsync ( options . OpenApi , logger , cancellationToken ) . ConfigureAwait ( false ) ;
244+ var result = await ParseOpenApiAsync ( options . OpenApi , options . InlineExternal , logger , stream , cancellationToken ) . ConfigureAwait ( false ) ;
245245 document = result . OpenApiDocument ;
246246 }
247247 else throw new InvalidOperationException ( "No input file path or URL provided" ) ;
@@ -323,7 +323,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe
323323 /// Implementation of the validate command
324324 /// </summary>
325325 /// <returns><see langword="true"/> when valid, <see langword="false"/> when invalid and <see langword="null"/> when cancelled</returns>
326- public static async Task < bool ? > ValidateOpenApiDocument (
326+ public static async Task < bool ? > ValidateOpenApiDocumentAsync (
327327 string openApi ,
328328 ILogger logger ,
329329 CancellationToken cancellationToken = default )
@@ -337,9 +337,9 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe
337337
338338 try
339339 {
340- using var stream = await GetStream ( openApi , logger , cancellationToken ) . ConfigureAwait ( false ) ;
340+ using var stream = await GetStreamAsync ( openApi , logger , cancellationToken ) . ConfigureAwait ( false ) ;
341341
342- result = await ParseOpenApi ( openApi , false , logger , stream , cancellationToken ) . ConfigureAwait ( false ) ;
342+ result = await ParseOpenApiAsync ( openApi , false , logger , stream , cancellationToken ) . ConfigureAwait ( false ) ;
343343
344344 using ( logger . BeginScope ( "Calculating statistics" ) )
345345 {
@@ -367,7 +367,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe
367367 return result . OpenApiDiagnostic . Errors . Count == 0 ;
368368 }
369369
370- private static async Task < ReadResult > ParseOpenApi ( string openApiFile , bool inlineExternal , ILogger logger , Stream stream , CancellationToken cancellationToken = default )
370+ private static async Task < ReadResult > ParseOpenApiAsync ( string openApiFile , bool inlineExternal , ILogger logger , Stream stream , CancellationToken cancellationToken = default )
371371 {
372372 ReadResult result ;
373373 var stopwatch = Stopwatch . StartNew ( ) ;
@@ -398,7 +398,7 @@ private static async Task<ReadResult> ParseOpenApi(string openApiFile, bool inli
398398 /// </summary>
399399 /// <param name="csdl">The CSDL stream.</param>
400400 /// <returns>An OpenAPI document.</returns>
401- public static async Task < OpenApiDocument > ConvertCsdlToOpenApi ( Stream csdl , string ? metadataVersion = null , IConfiguration ? settings = null , CancellationToken token = default )
401+ public static async Task < OpenApiDocument > ConvertCsdlToOpenApiAsync ( Stream csdl , string ? metadataVersion = null , IConfiguration ? settings = null , CancellationToken token = default )
402402 {
403403 using var reader = new StreamReader ( csdl ) ;
404404 var csdlText = await reader . ReadToEndAsync ( token ) . ConfigureAwait ( false ) ;
@@ -486,7 +486,7 @@ private static Dictionary<string, List<string>> EnumerateJsonDocument(JsonElemen
486486 /// <summary>
487487 /// Reads stream from file system or makes HTTP request depending on the input string
488488 /// </summary>
489- private static async Task < Stream > GetStream ( string input , ILogger logger , CancellationToken cancellationToken = default )
489+ private static async Task < Stream > GetStreamAsync ( string input , ILogger logger , CancellationToken cancellationToken = default )
490490 {
491491 Stream stream ;
492492 using ( logger . BeginScope ( "Reading input stream" ) )
@@ -562,7 +562,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl
562562 return extension ;
563563 }
564564
565- internal static async Task < string ? > ShowOpenApiDocument ( HidiOptions options , ILogger logger , CancellationToken cancellationToken = default )
565+ internal static async Task < string ? > ShowOpenApiDocumentAsync ( HidiOptions options , ILogger logger , CancellationToken cancellationToken = default )
566566 {
567567 try
568568 {
@@ -571,7 +571,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl
571571 throw new ArgumentException ( "Please input a file path or URL" ) ;
572572 }
573573
574- var document = await GetOpenApi ( options , logger , null , cancellationToken ) . ConfigureAwait ( false ) ;
574+ var document = await GetOpenApiAsync ( options , logger , null , cancellationToken ) . ConfigureAwait ( false ) ;
575575
576576 using ( logger . BeginScope ( "Creating diagram" ) )
577577 {
@@ -722,17 +722,17 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d
722722 writer . WriteLine ( "</html" ) ;
723723 }
724724
725- internal static async Task PluginManifest ( HidiOptions options , ILogger logger , CancellationToken cancellationToken = default )
725+ internal static async Task PluginManifestAsync ( HidiOptions options , ILogger logger , CancellationToken cancellationToken = default )
726726 {
727727 // If ApiManifest is provided, set the referenced OpenAPI document
728- var apiDependency = await FindApiDependency ( options . FilterOptions ? . FilterByApiManifest , logger , cancellationToken ) . ConfigureAwait ( false ) ;
728+ var apiDependency = await FindApiDependencyAsync ( options . FilterOptions ? . FilterByApiManifest , logger , cancellationToken ) . ConfigureAwait ( false ) ;
729729 if ( apiDependency != null )
730730 {
731731 options . OpenApi = apiDependency . ApiDescripionUrl ;
732732 }
733733
734734 // Load OpenAPI document
735- var document = await GetOpenApi ( options , logger , options . MetadataVersion , cancellationToken ) . ConfigureAwait ( false ) ;
735+ var document = await GetOpenApiAsync ( options , logger , options . MetadataVersion , cancellationToken ) . ConfigureAwait ( false ) ;
736736
737737 cancellationToken . ThrowIfCancellationRequested ( ) ;
738738
0 commit comments