@@ -11,7 +11,7 @@ namespace AsyncAPI.Feature;
11
11
12
12
public class ApiDocumentGenerator ( IServiceProvider serviceProvider ) : IAsyncApiDocumentGenerator
13
13
{
14
- public async Task < IEnumerable < IAsyncApiDocument > > GenerateAsync ( IEnumerable < Type > markupTypes , AsyncApiDocumentGenerationOptions options , CancellationToken cancellationToken = default )
14
+ public Task < IEnumerable < IAsyncApiDocument > > GenerateAsync ( IEnumerable < Type > markupTypes , AsyncApiDocumentGenerationOptions options , CancellationToken cancellationToken = default )
15
15
{
16
16
ArgumentNullException . ThrowIfNull ( options ) ;
17
17
@@ -21,14 +21,14 @@ public async Task<IEnumerable<IAsyncApiDocument>> GenerateAsync(IEnumerable<Type
21
21
var document = serviceProvider . GetRequiredService < IV3AsyncApiDocumentBuilder > ( ) ;
22
22
options . V3BuilderSetup ? . Invoke ( document ) ;
23
23
24
- await GenerateChannels ( document , options , cancellationToken ) ;
24
+ GenerateChannels ( document , options ) ;
25
25
26
26
documents . Add ( document . Build ( ) ) ;
27
27
28
- return documents ;
28
+ return Task . FromResult < IEnumerable < IAsyncApiDocument > > ( documents ) ;
29
29
}
30
30
31
- async Task GenerateChannels ( IV3AsyncApiDocumentBuilder document , AsyncApiDocumentGenerationOptions options , CancellationToken cancellationToken = default )
31
+ void GenerateChannels ( IV3AsyncApiDocumentBuilder document , AsyncApiDocumentGenerationOptions options )
32
32
{
33
33
ArgumentNullException . ThrowIfNull ( document ) ;
34
34
ArgumentNullException . ThrowIfNull ( options ) ;
@@ -47,13 +47,13 @@ async Task GenerateChannels(IV3AsyncApiDocumentBuilder document, AsyncApiDocumen
47
47
. WithAddress ( typeCache . EndpointName )
48
48
. WithDescription ( actualType . FullName ) ;
49
49
} ) ;
50
- await GenerateV3OperationForAsync ( document , channelName , channelBuilder , actualType , publishedType , options , cancellationToken ) ;
50
+ GenerateV3OperationFor ( document , channelName , channelBuilder , actualType , publishedType , options ) ;
51
51
}
52
52
53
53
//NOTE this is where more channels and operations can be defined, for example subscribed to events, sent/received commands and messages
54
54
}
55
55
56
- Task GenerateV3OperationForAsync ( IV3AsyncApiDocumentBuilder document , string channelName , IV3ChannelDefinitionBuilder channel , Type actualType , Type producedType , AsyncApiDocumentGenerationOptions options , CancellationToken cancellationToken = default )
56
+ static void GenerateV3OperationFor ( IV3AsyncApiDocumentBuilder document , string channelName , IV3ChannelDefinitionBuilder channel , Type actualType , Type producedType , AsyncApiDocumentGenerationOptions options )
57
57
{
58
58
ArgumentNullException . ThrowIfNull ( document ) ;
59
59
ArgumentException . ThrowIfNullOrWhiteSpace ( channelName ) ;
@@ -83,6 +83,5 @@ Task GenerateV3OperationForAsync(IV3AsyncApiDocumentBuilder document, string cha
83
83
. WithChannel ( $ "#/channels/{ channelName } ")
84
84
. WithMessage ( messageChannelReference ) ;
85
85
} ) ;
86
- return Task . CompletedTask ;
87
86
}
88
87
}
0 commit comments