Skip to content

Commit 7247f74

Browse files
committed
More smells
1 parent 5d6db61 commit 7247f74

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ internal class PowerShellFormatter : OpenApiVisitorBase
2323
static PowerShellFormatter()
2424
{
2525
// Add singularization exclusions.
26-
// TODO: Read exclusions from a user provided file.
26+
// Enhancement: Read exclusions from a user provided file.
2727
Vocabularies.Default.AddSingular("(drive)s$", "$1"); // drives does not properly singularize to drive.
2828
Vocabularies.Default.AddSingular("(data)$", "$1"); // exclude the following from singularization.
2929
Vocabularies.Default.AddSingular("(delta)$", "$1");
3030
Vocabularies.Default.AddSingular("(quota)$", "$1");
3131
Vocabularies.Default.AddSingular("(statistics)$", "$1");
3232
}
3333

34-
//TODO: FHL taks for PS
34+
//FHL task for PS
3535
// Fixes (Order matters):
3636
// 1. Singularize operationId operationIdSegments.
3737
// 2. Add '_' to verb in an operationId.
@@ -64,7 +64,7 @@ public override void Visit(OpenApiPathItem pathItem)
6464
public override void Visit(OpenApiOperation operation)
6565
{
6666
if (string.IsNullOrWhiteSpace(operation.OperationId))
67-
throw new ArgumentException(nameof(operation), $"OperationId is required {PathString}");
67+
throw new ArgumentException($"OperationId is required {PathString}", nameof(operation));
6868

6969
var operationId = operation.OperationId;
7070
var operationTypeExtension = operation.Extensions.GetExtension("x-ms-docs-operation-type");
@@ -128,7 +128,7 @@ private static string SingularizeAndDeduplicateOperationId(IList<string> operati
128128

129129
// If a segment name is contained in the previous segment, the latter is considered a duplicate.
130130
// The last segment is ignored as a rule.
131-
if ((x > 0 && x < lastSegmentIndex) && singularizedSegments.Last().Equals(segment, StringComparison.OrdinalIgnoreCase))
131+
if ((x > 0 && x < lastSegmentIndex) && singularizedSegments[singularizedSegments.Count - 1].Equals(segment, StringComparison.OrdinalIgnoreCase))
132132
continue;
133133

134134
singularizedSegments.Add(segment);

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ internal async static Task PluginManifest(HidiOptions options, ILogger logger, C
723723
}
724724
var slicedOpenApi = new FileInfo(Path.Combine(options.OutputFolder,"openapi.json"));
725725
// Write OpenAPI to Output folder
726+
options.Output = slicedOpenApi;
726727
options.TerseOutput =true;
727728
WriteOpenApi(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_0, document, logger);
728729

0 commit comments

Comments
 (0)