Skip to content

Commit 50b7dbd

Browse files
committed
Update method return types
1 parent 275aa28 commit 50b7dbd

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/OpenApi/src/Services/OpenApiDocumentService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,12 @@ private async Task<OpenApiOperation> GetOperationAsync(
326326
=> description.ActionDescriptor.AttributeRouteInfo?.Name ??
327327
description.ActionDescriptor.EndpointMetadata.OfType<IEndpointNameMetadata>().LastOrDefault()?.EndpointName;
328328

329-
private static ISet<OpenApiTagReference> GetTags(ApiDescription description, OpenApiDocument document)
329+
private static HashSet<OpenApiTagReference> GetTags(ApiDescription description, OpenApiDocument document)
330330
{
331331
var actionDescriptor = description.ActionDescriptor;
332332
if (actionDescriptor.EndpointMetadata?.OfType<ITagsMetadata>().LastOrDefault() is { } tagsMetadata)
333333
{
334-
ISet<OpenApiTagReference> tags = new HashSet<OpenApiTagReference>();
334+
HashSet<OpenApiTagReference> tags = [];
335335
foreach (var tag in tagsMetadata.Tags)
336336
{
337337
document.Tags ??= new HashSet<OpenApiTag>();
@@ -346,7 +346,7 @@ private static ISet<OpenApiTagReference> GetTags(ApiDescription description, Ope
346346
var controllerName = description.ActionDescriptor.RouteValues["controller"];
347347
document.Tags ??= new HashSet<OpenApiTag>();
348348
document.Tags.Add(new OpenApiTag { Name = controllerName });
349-
return new HashSet<OpenApiTagReference> { new(controllerName, document) };
349+
return [new(controllerName, document)];
350350
}
351351

352352
private async Task<OpenApiResponses> GetResponsesAsync(

src/OpenApi/src/Services/OpenApiGenerator.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ private static void GenerateDefaultResponses(Dictionary<int, (Type?, MediaTypeCo
324324
return null;
325325
}
326326

327-
private ISet<OpenApiTagReference> GetOperationTags(MethodInfo methodInfo, EndpointMetadataCollection metadata)
327+
private HashSet<OpenApiTagReference> GetOperationTags(MethodInfo methodInfo, EndpointMetadataCollection metadata)
328328
{
329329
var metadataList = metadata.GetOrderedMetadata<ITagsMetadata>();
330330
var document = new OpenApiDocument();
@@ -361,10 +361,7 @@ private ISet<OpenApiTagReference> GetOperationTags(MethodInfo methodInfo, Endpoi
361361

362362
document.Tags ??= new HashSet<OpenApiTag>();
363363
document.Tags.Add(new OpenApiTag { Name = controllerName });
364-
return new HashSet<OpenApiTagReference>
365-
{
366-
new(controllerName, document)
367-
};
364+
return [new(controllerName, document)];
368365
}
369366

370367
private List<IOpenApiParameter> GetOpenApiParameters(MethodInfo methodInfo, RoutePattern pattern, bool disableInferredBody)

0 commit comments

Comments
 (0)