nestjs-asyncapi
nestjs-asyncapi copied to clipboard
Implement support for AsyncApi 2.3.0
AsyncApi 2.3.0 was released few days ago: https://www.asyncapi.com/blog/release-notes-2.3.0 which allows "Servers and channels can now be defined as reusable components". It would be great to implement some "server" key into AsyncApiPub() and AsyncApiSub() decorators
hey @pavlikm, can u give an example of server key usage in AsyncApiX() decorators?
- yaml example with server key would be nice
@flamewow I have defined servers in nestjs application like this:
const asyncApiOptions = new AsyncApiDocumentBuilder()
.setTitle('...')
.setDescription('...')
.setVersion('1.0')
.setDefaultContentType('application/json')
.addServer('messaging', messagesServer)
.addServer('users', userServer)
.addServer('system', systemServer)
.addServer('notifications', notificationsServer)
.build()
where notifications, systemServer, userServer and messagesServer are of type AsyncServerObject. So it would be great, If I could define server in AsyncApiPub() and AsyncApiSub() decorators like this:
@AsyncApiPub({
channel: Events.GET_PRIVATE_CONVERSATION_MESSAGES,
summary: '...',
description: '...',
tags: [{name: "messaging"}],
server: messagesServer,
message: {
name: 'GetPrivateConversationMessages',
payload: {
type: () => GetPrivateConversationMessages,
},
},
})
stale1