@@ -479,7 +479,7 @@ public async Task OperationTransformer_CanAccessTransientServiceFromContextAppli
479479 }
480480
481481 [ Fact ]
482- public async Task WithOpenApi_CanApplyTransformer ( )
482+ public async Task AddOpenApiOperationTransformer_CanApplyTransformer ( )
483483 {
484484 var builder = CreateBuilder ( ) ;
485485
@@ -503,7 +503,7 @@ await VerifyOpenApiDocument(builder, document =>
503503 }
504504
505505 [ Fact ]
506- public async Task WithOpenApi_TransformerRunsAfterOtherTransformers ( )
506+ public async Task AddOpenApiOperationTransformer_TransformerRunsAfterOtherTransformers ( )
507507 {
508508 var builder = CreateBuilder ( ) ;
509509
@@ -533,6 +533,44 @@ await VerifyOpenApiDocument(builder, document =>
533533 } ) ;
534534 }
535535
536+ [ Fact ]
537+ public async Task AddOpenApiOperationTransformer_SupportsMultipleTransformers ( )
538+ {
539+ var builder = CreateBuilder ( ) ;
540+
541+ builder . MapGet ( "/" , ( ) => { } )
542+ . AddOpenApiOperationTransformer ( ( operation , context , cancellationToken ) =>
543+ {
544+ operation . Description = "Operation Description" ;
545+ return Task . CompletedTask ;
546+ } )
547+ . AddOpenApiOperationTransformer ( ( operation , context , cancellationToken ) =>
548+ {
549+ operation . Description += " 2" ;
550+ operation . Deprecated = true ;
551+ return Task . CompletedTask ;
552+ } )
553+ . AddOpenApiOperationTransformer ( ( operation , context , cancellationToken ) =>
554+ {
555+ operation . Description += " 3" ;
556+ operation . OperationId = "OperationId" ;
557+ return Task . CompletedTask ;
558+ } ) ;
559+
560+ await VerifyOpenApiDocument ( builder , document =>
561+ {
562+ Assert . Collection ( document . Paths . OrderBy ( p => p . Key ) ,
563+ path =>
564+ {
565+ Assert . Equal ( "/" , path . Key ) ;
566+ var operation = Assert . Single ( path . Value . Operations . Values ) ;
567+ Assert . Equal ( "Operation Description 2 3" , operation . Description ) ;
568+ Assert . True ( operation . Deprecated ) ;
569+ Assert . Equal ( "OperationId" , operation . OperationId ) ;
570+ } ) ;
571+ } ) ;
572+ }
573+
536574 private class ActivatedTransformer : IOpenApiOperationTransformer
537575 {
538576 public Task TransformAsync ( OpenApiOperation operation , OpenApiOperationTransformerContext context , CancellationToken cancellationToken )
0 commit comments