AsyncAPI documentation: render it locally, then publish it from Git
Last checked and updated
An AsyncAPI document is meant to be read by the teams that send or receive its messages, so the usual way to share it is a documentation page: the servers, then every channel with its messages and payload fields, then the operations. With APIGit you check it with apigit lint, look at the page with apigit preview before you commit, and publish a version from a commit. AsyncAPI 2.x and 3.x files are both rendered.
1. Check the file
$ apigit lint asyncapi.yaml
asyncapi.yaml
1:11 info asyncapi-latest-version The latest version is not used. You should update to the "3.1.0" version. (asyncapi)
1 problem (0 errors, 0 warnings, 1 info, 0 hints)
The file is the order service from AsyncAPI channels, operations and messages. What makes the rendered page useful is what the linter's warnings ask for: an info.description (CommonMark, in AsyncAPI 3.0), a contact, a server, and a description on each operation. Lint an AsyncAPI file lists them.
2. See the page before you commit
In the folder of a git repository:
$ apigit preview --port 4713 --no-open
Site settings: none (no repository found); showing the default look
Preview of .../order-events at http://127.0.0.1:4713/ (Ctrl+C to stop)
The first run downloads the viewer of the published pages (the CLI documentation gives about 9 MB) and keeps it; later runs work offline. The page reloads when you save. The first line means the folder is not a clone of a repository on APIGit, so the preview uses the default look; in a clone, signed in, it reads the repository's saved site settings. Without --port it listens on 4011, and without --no-open it opens the browser.
The page for this file showed, from top to bottom:
- the title and version (
Orders events 1.0.0), the description, the contact (name, URL, email) and the license; - Servers:
production,broker.example.com:5672; - the channel
orders.created, "Accepts the following message:", theorderCreatedpayload as a table of fields and a generated sample,{"orderId": "string", "total": 0}; - the operation
publishOrderCreatedunder Send, with its description.
What the preview shows is your working copy: the files git tracks plus new ones it does not ignore, with uncommitted edits. A file that does not parse is shown with the error and its source instead of a reference.
3. Commit, push, publish
A publish uses a commit that is already on APIGit. A version is "a name pointing at a commit", and it includes "the OpenAPI specs, AsyncAPI documents and GraphQL schemas at that commit", the Markdown documents, and "the navigation and theme from that commit's apigit.json".
In the browser: open the repository, switch to the branch, click Publish and choose Publish API & Doc; the dialog asks for a version name, the update strategy (pin to the commit, or follow the branch on paid plans) and the access. From a terminal, in a clone:
$ apigit --dry-run doc publish --version 1.0.0 --access public -R acme/order-events
Using HEAD a88a67f of the working directory (it must be pushed)
Would send POST /api/v1/app/apispec/acme/order-events/create
{
"version": "1.0.0",
"commit_sha": "a88a67fe38a3a3536b489129bdf0fce46183434d",
"access": 2,
"enable_tryit": false
}
--dry-run prints the request and sends nothing; without it, the same command publishes. Inside a clone whose origin is the repository on APIGit, -R is not needed; outside one, the command stops with error: no repository: pass -R <owner>/<name>, set "repo" in apigit.yaml, or run inside a clone whose origin is the APIGit repository. --access takes member, public or viewers; the default is member.
What a published AsyncAPI version has
| AsyncAPI | Note | |
|---|---|---|
| Reference page with servers, channels, messages, operations | Yes | the page above |
Navigation and theme from apigit.json | Yes | list the file by its repository path |
| Copy page and original-file download | Yes | the browser also offers a bundled download |
One generated Markdown page for AI agents, in llms.txt and the document MCP search | Yes | per file, not per operation |
| Try It Out | No | OpenAPI only |
| Mock server | No | "It does not run an event broker or provide an AsyncAPI mock server." |
To put several files in one site, an event API beside a REST API and a GraphQL schema, see GraphQL and OpenAPI in one repository; the same apigit.json lists an AsyncAPI file by its path.