Understand the generated AsyncAPI document structure
mainSaunter automatically generates an AsyncAPI document based on your code. A key behavior to note is that schemas are automatically moved to the components/schemas section of the document to ensure valid AsyncAPI structure.
The document includes:
channels: Defines the communication paths (e.g.,publish/light/measured,subscribe/light/measured).components/schemas: Contains the data structures (e.g.,lightMeasuredEvent).components/messages: Defines the messages used in channels, referencing the schemas.components/bindings: Contains channel and operation bindings (e.g.,amqporhttpbindings).
{
"asyncapi": "2.6.0",
"channels": {
"publish/light/measured": {
"message": { "$ref": "#/components/messages/lightMeasuredEvent" }
}
},
"components": {
"schemas": {
"lightMeasuredEvent": {
"type": "object",
"properties": {
"id": { "type": "integer", "format": "int32" },
"lumens": { "type": "integer", "format": "int32" }
}
}
}
}
}