Skip to main content

AsyncAPI plugin for Litestar

Project description

litestar-asyncapi

AsyncAPI support for Litestar applications. This plugin generates AsyncAPI 3.0 documents for WebSocket routes and (best-effort) ChannelsPlugin channels, and provides JSON/YAML/UI renderers.

Usage

from litestar import Litestar
from litestar_asyncapi import AsyncAPIConfig, AsyncAPIPlugin

config = AsyncAPIConfig(
    use_handler_docstrings=True,
    create_examples=True,
    random_seed=1,
)

app = Litestar(plugins=[AsyncAPIPlugin(config=config)])

By default, the plugin serves docs at /asyncapi/ with JSON at /asyncapi/asyncapi.json and YAML at /asyncapi/asyncapi.yaml.

When enabled, docstrings and handler metadata (summary, description, operation_id) are used to enrich AsyncAPI operations, and example payloads are generated for message schemas. AsyncAPI decorators still take precedence over inferred metadata.

Documentation

Build the docs locally:

make docs

Link check:

make docs-linkcheck

The HTML output is written to docs/_build/html. The GitHub Pages deployment is handled by the docs workflow.

CI and Release

  • CI runs linting, type checks, and test matrix across supported Python versions.
  • The release workflow is publish.yml (workflow name: pypi) and publishes to PyPI on GitHub release.

Notes

  • Operation IDs are generated deterministically and are unique across the document.
  • Channel message references are emitted under each channel, with operations referencing those messages.
  • Component key overrides are sanitized to valid schema component names.
  • Channel parameter schemas are filtered to AsyncAPI v3-compatible fields.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

litestar_asyncapi-0.1.0.tar.gz (212.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

litestar_asyncapi-0.1.0-py3-none-any.whl (49.9 kB view details)

Uploaded Python 3

File details

Details for the file litestar_asyncapi-0.1.0.tar.gz.

File metadata

  • Download URL: litestar_asyncapi-0.1.0.tar.gz
  • Upload date:
  • Size: 212.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for litestar_asyncapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bfde4d0963d56aa4a39c3b8c4db0ea8b8032f523df40f4b166ac663c3a60bbff
MD5 f9d1e888bfc9de99d6031b282db6ef3b
BLAKE2b-256 0423f98915f3ee8663e922cd6bd7b5341f5ca25675f0cf74a1b9cfa976cd8763

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_asyncapi-0.1.0.tar.gz:

Publisher: publish.yml on cofin/litestar-asyncapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file litestar_asyncapi-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for litestar_asyncapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69443e938530f56b9de5572768b4a505311a556c98ca9174a01a3843b11bb28a
MD5 dad4849e82cee2ff81f9c67bcacd69ac
BLAKE2b-256 6979cc15a5233cc11e80ec17d3779bc1ebb47d58b62f0989fa8547ad75f6baa3

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_asyncapi-0.1.0-py3-none-any.whl:

Publisher: publish.yml on cofin/litestar-asyncapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page