Skip to content

Renderers

from litestar_asyncapi import AsyncAPIRenderPlugin, AsyncAPIUIRenderPlugin, JsonRenderPlugin, YamlRenderPlugin

Render plugins serve the document under DocsConfig.path. Pass them in DocsConfig.render_plugins to replace the default UI and JSON routes.

Documentation UI

litestar_asyncapi.AsyncAPIUIRenderPlugin

Bases: AsyncAPIRenderPlugin

Serve the packaged documentation UI as an HTML page.

Parameters:

Name Type Description Default
path str | Sequence[str]

Route path or paths relative to DocsConfig.path.

'/'
renderer Literal['asyncapi', 'scalar']

UI to load: the AsyncAPI React component or Scalar.

'asyncapi'
interactive bool

Whether the React view offers the WebSocket console; Scalar does not support it.

False
role Literal['documentation', 'playground']

playground marks the console page that DocsConfig.interactive adds.

'documentation'
config dict[str, Any] | None

Options passed to the UI component.

None
**kwargs Any

Other OpenAPIRenderPlugin arguments, such as favicon or style.

{}

Raises:

Type Description
ValueError

If renderer is scalar and interactive is true.

Document renderers

JsonRenderPlugin and YamlRenderPlugin are Litestar's OpenAPI render plugins of the same names, re-exported unchanged. They serve the canonical document as application/vnd.asyncapi+json and application/vnd.asyncapi+yaml in the default configuration.

AsyncAPIRenderPlugin is Litestar's OpenAPIRenderPlugin. Subclass it and implement render to serve the document in another form; the openapi_schema argument receives the AsyncAPI document.