@@ -10,9 +10,9 @@ public class AnnotationsOperationFilter : IOperationFilter
1010 {
1111 public void Apply ( OpenApiOperation operation , OperationFilterContext context )
1212 {
13- IEnumerable < object > controllerAttributes = Array . Empty < object > ( ) ;
14- IEnumerable < object > actionAttributes = Array . Empty < object > ( ) ;
15- IEnumerable < object > metadataAttributes = Array . Empty < object > ( ) ;
13+ IEnumerable < object > controllerAttributes = [ ] ;
14+ IEnumerable < object > actionAttributes = [ ] ;
15+ IEnumerable < object > metadataAttributes = [ ] ;
1616
1717 if ( context . MethodInfo != null )
1818 {
@@ -63,12 +63,13 @@ private static void ApplySwaggerOperationAttribute(
6363 if ( swaggerOperationAttribute . OperationId != null )
6464 operation . OperationId = swaggerOperationAttribute . OperationId ;
6565
66+ // TODO Fix this
67+ #if ! NET10_0_OR_GREATER
6668 if ( swaggerOperationAttribute . Tags != null )
6769 {
68- operation . Tags = swaggerOperationAttribute . Tags
69- . Select ( tagName => new OpenApiTag { Name = tagName } )
70- . ToList ( ) ;
70+ operation . Tags = [ .. swaggerOperationAttribute . Tags . Select ( tagName => new OpenApiTag { Name = tagName } ) ] ;
7171 }
72+ #endif
7273 }
7374
7475 public static void ApplySwaggerOperationFilterAttributes (
@@ -86,7 +87,7 @@ public static void ApplySwaggerOperationFilterAttributes(
8687 }
8788 }
8889
89- private void ApplySwaggerResponseAttributes (
90+ private static void ApplySwaggerResponseAttributes (
9091 OpenApiOperation operation ,
9192 OperationFilterContext context ,
9293 IEnumerable < object > controllerAndActionAttributes )
@@ -97,10 +98,7 @@ private void ApplySwaggerResponseAttributes(
9798 {
9899 var statusCode = swaggerResponseAttribute . StatusCode . ToString ( ) ;
99100
100- if ( operation . Responses == null )
101- {
102- operation . Responses = new OpenApiResponses ( ) ;
103- }
101+ operation . Responses ??= [ ] ;
104102
105103 if ( ! operation . Responses . TryGetValue ( statusCode , out OpenApiResponse response ) )
106104 {
0 commit comments