Serving the AsyncAPI Documentation#
FastStream provides a command to serve the AsyncAPI documentation.
Note
This feature requires an Internet connection to obtain the AsyncAPI HTML via CDN.
In the above command, we are providing the path in the format of python_module:FastStream
. Alternatively, you can also specify asyncapi.json
or asyncapi.yaml
to serve the AsyncAPI documentation.
After running the command, it should serve the AsyncAPI documentation on port 8000 and display the following logs in the terminal.
INFO: Started server process [2364992]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://localhost:8000 (Press CTRL+C to quit)
And you should be able to see the following page in your browser:
Tip
The command also offers options to serve the documentation on a different host and port.
Customizing AsyncAPI Documentation#
FastStream also provides query parameters to show and hide specific sections of AsyncAPI documentation.
You can use the following parameters control the visibility of relevant sections:
sidebar
: Whether to include the sidebar. Default is true.info
: Whether to include the info section. Default is true.servers
: Whether to include the servers section. Default is true.operations
: Whether to include the operations section. Default is true.messages
: Whether to include the messages section. Default is true.schemas
: Whether to include the schemas section. Default is true.errors
: Whether to include the errors section. Default is true.expandMessageExamples
: Whether to expand message examples. Default is true.
For example, to hide the entire Servers
section of the documentation, simply add servers=false
as a query parameter, i.e., http://localhost:8000?servers=false. The resulting page would look like the image below:
Please use the above-listed query parameters to show and hide sections of the AsyncAPI documentation.