Skip to content

Commit 5550f01

Browse files
committed
Clean up code
1 parent 1d986d1 commit 5550f01

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,21 @@ string filterbycollection
8383
Stream stream;
8484
OpenApiDocument document;
8585
OpenApiFormat openApiFormat;
86+
var stopwatch = new Stopwatch();
8687

8788
if (!string.IsNullOrEmpty(csdl))
8889
{
8990
// Default to yaml during csdl to OpenApi conversion
90-
openApiFormat = format ?? GetOpenApiFormat(csdl);
91+
openApiFormat = format ?? GetOpenApiFormat(csdl, logger);
9192

92-
stream = GetStream(csdl);
93+
stream = await GetStream(csdl, logger);
9394
document = ConvertCsdlToOpenApi(stream);
9495
}
9596
else
9697
{
97-
stream = GetStream(openapi, logger);
98+
stream = await GetStream(openapi, logger);
9899

99100
// Parsing OpenAPI file
100-
var stopwatch = new Stopwatch();
101101
stopwatch.Start();
102102
logger.LogTrace("Parsing OpenApi file");
103103
var result = new OpenApiStreamReader(new OpenApiReaderSettings
@@ -126,7 +126,7 @@ string filterbycollection
126126
logger.LogTrace("{timestamp}ms: Parsed OpenApi successfully. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count);
127127
}
128128

129-
openApiFormat = format ?? GetOpenApiFormat(openapi);
129+
openApiFormat = format ?? GetOpenApiFormat(openapi, logger);
130130
version ??= result.OpenApiDiagnostic.SpecificationVersion;
131131
}
132132

src/Microsoft.OpenApi.Hidi/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static async Task<int> Main(string[] args)
1919
var descriptionOption = new Option<string>("--openapi", "Input OpenAPI description file path or URL");
2020
descriptionOption.AddAlias("-d");
2121

22-
var csdlOption = new Option("--csdl", "Input CSDL file path or URL", typeof(string));
22+
var csdlOption = new Option<string>("--csdl", "Input CSDL file path or URL");
2323
csdlOption.AddAlias("-cs");
2424

2525
var outputOption = new Option<FileInfo>("--output", () => new FileInfo("./output"), "The output directory path for the generated file.") { Arity = ArgumentArity.ZeroOrOne };
@@ -72,8 +72,8 @@ static async Task<int> Main(string[] args)
7272
resolveExternalOption,
7373
};
7474

75-
transformCommand.SetHandler<string, FileInfo, OpenApiSpecVersion?, OpenApiFormat?, LogLevel, bool, bool, string, string, string> (
76-
OpenApiService.ProcessOpenApiDocument, descriptionOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption);
75+
transformCommand.SetHandler<string, string, FileInfo, OpenApiSpecVersion?, OpenApiFormat?, LogLevel, bool, bool, string, string, string> (
76+
OpenApiService.ProcessOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption);
7777

7878
rootCommand.Add(transformCommand);
7979
rootCommand.Add(validateCommand);

0 commit comments

Comments
 (0)