Render AsyncAPI documents
AsyncAPI support is still a work in progress. Not every part of the specification is rendered.
Load an AsyncAPI document#
Pass an AsyncAPI document URL or content to Scalar.createApiReference, just as you would with OpenAPI.
Scalar.createApiReference('#app', {
url: '/asyncapi.json'
})You can render AsyncAPI alongside OpenAPI documents in one reference or add it to a Scalar Docs project with an asyncapi navigation entry.
OpenAPI and AsyncAPI concepts#
| OpenAPI | AsyncAPI | Scalar reference |
|---|---|---|
| Path | Channel | Sidebar entry with address, description, and parameters |
get or post operation |
Operation with send or receive action |
Nested under its channel |
| Request and response bodies | Message payloads | Collapsible message accordions |
servers[].url |
host, pathname, and protocol |
Server and protocol labels |
components.schemas |
components.schemas |
Models section |
receive means the application receives the message, so the client sends it. send means the application sends the message to the client.
Supported versions#
The reference renders the AsyncAPI 3.x shape. Older 1.x and 2.x documents are upgraded automatically on load.
What the reference renders#
Channels and operations
- Channel titles, addresses, descriptions, and parameters.
- Operations with
sendorreceiveactions.
Servers and protocols
- Server and protocol labels.
- Protocol and server filters when the document defines multiple options.
Messages and models
- Messages with headers and payload schemas.
- Reusable schemas in the Models section.
- Message examples and generated payload examples when no payload example exists.
Authentication
- Document-wide authentication from server security requirements.
Messages start collapsed and follow the sidebar when a reader opens a deep link.
Authentication and SDK generation#
AsyncAPI authentication supports these shared security types:
httpoauth2openIdConnectapiKeyhttpApiKey
Broker-specific credential inputs are supported too.
The same document can feed the SDK Generator. AsyncAPI input there is experimental and turns channels into typed WebSocket or HTTP streaming methods.