asyncapi-operation-messages
asyncapi-operation-messages checks that each operation has a non-empty messages list and that each message reference exists.
Why did this violation appear?
An operation has no messages, an empty list, or a reference to a missing component message.
Bad example
asyncapi: 3.1.0
channels: {}
operations:
receiveUserCreated:
action: receive
messages:
- $ref: '#/components/messages/MissingMessage'
components:
messages: {}
Good example
asyncapi: 3.1.0
channels:
userCreated:
address: users/created
operations:
receiveUserCreated:
action: receive
description: Receive user creation events.
channel:
$ref: '#/channels/userCreated'
messages:
- $ref: '#/components/messages/UserCreated'
components:
messages:
UserCreated:
payload:
type: object
How do I fix this violation?
Declare each message under components.messages and reference it from the operation.
