Changelog¶
All notable changes to this project will be documented in this file.
0.3.0¶
This release fixes generated contracts and the published import, inherits document metadata and security schemes from Litestar's OpenAPI config, and documents Server-Sent Event routes and ChannelsPlugin topics. It requires Python 3.11 and includes breaking changes to operation keys, Kafka binding keys and the default document title. See the migration guide.
Changed¶
- Python 3.10 is no longer supported. The package requires Python 3.11 or newer and is tested on Python 3.11 to 3.15.
- The AsyncAPI enums (
OperationAction,SchemaType,SchemaFormat,SecuritySchemeType) areStrEnums, sostr()returns the wire value. - The document title now defaults to the application's OpenAPI title, which is
Litestar APIunless you set one, instead ofAsyncAPI. This is a breaking change; setAsyncAPIConfig(title=...)to keep a fixed title.
Added¶
- Document metadata is inherited from the application's
OpenAPIConfig. Unsettitle,version,description,contact,license,terms_of_serviceandexternal_docsonAsyncAPIConfigare filled from it, and explicit values win. Tags are not inherited. Turn this off withAsyncAPIConfig(inherit_openapi=False). - Security schemes defined in the application's OpenAPI config, including the
ones Litestar auth backends such as
JWTAuthregister, are added tocomponents.securitySchemes. Bearer, other HTTP, API key, OAuth2, OpenID Connect and mutual TLS schemes are converted to their AsyncAPI form. Schemes and OAuth flows that AsyncAPI cannot express, such as flows with relative URLs, are skipped with a warning. Security requirements are not inherited, and a configured scheme with the same name but a different definition raises. AsyncAPIConfig(inherit_openapi_servers=True)turns absolute OpenAPI server URLs intowsandwssservers, with their path, description and variables. Only channels discovered from WebSocket routes are bound to them. Relative URLs are skipped. Other channels require explicit nonempty server lists when derived servers exist; an omitted or empty list would select every document server. It is off by default.- Contracts can refer to things by name instead of JSON pointer.
OperationDefinition.securitytakes scheme names such as["BearerToken"],ChannelDefinition.serverstakes server names, and the newReplyDefinition(channel, messages, address)names the reply channel and its messages. Unknown names raise with the valid names listed, and a reply message must belong to the reply channel. A bare string in place of a list raisesTypeError. Objects andReferences keep working. - Every discovered channel now says which transport it uses. A channel carries
x-litestar-sourceset towebsocketorchannels, and an explicitbindingsobject: native WebSocket channels get awsbinding and ChannelsPlugin channels get an empty one. Client generators can pick the right client from the document alone. - HTTP routes that return
ServerSentEventare discovered as send-only channels withcontentType: text/event-stream, anhttpbinding andx-litestar-source: sse. Type their payload withasyncapi_message, and turn discovery off withAsyncAPIConfig(include_sse_routes=False). - Topics configured on a
ChannelsPluginare documented even without generated WebSocket routes, which is Litestar's default. Each topic without a route becomes a channel keyed by its name with onesendoperation. Topics are read when the application starts, so runtime subscriptions never appear. Turn this off withAsyncAPIConfig(include_channels_plugin_topics=False). AsyncAPIConfig.channel_payloadsmaps a ChannelsPlugin topic name to a payload type. The topic's generated route and topic channel then document the generated schema asapplication/json. Unknown topic names raise unless a plugin allows arbitrary channels, in which case the name declares a topic.ChannelDefinitionacceptsdescriptionandextensions. Explicit channels get no automatic transport marker.
Fixed¶
- The package imports again with only
litestarinstalled. Pydantic is needed only whencreate_examples=True. - Kafka binding keys now use their official names:
schemaRegistryUrlandschemaRegistryVendoron servers, andschemaIdLocation,schemaIdPayloadEncodingandschemaLookupStrategyon messages. Documents using these bindings now pass official validation. This is a breaking change for anyone matching the oldregistry_*,id_*orlookup_strategykeys. - An explicit
Schema(prefix_items=...)now exports Draft07 tuple items: the positional schemas become anitemsarray anditemsbecomesadditionalItems. Previously the Draft07 document carriedprefixItems, which validators ignore. Settingitems,additional_itemsandprefix_itemstogether now raisesValueError. - A variable-length tuple with length limits, such as
Annotated[tuple[int, ...], Parameter(max_items=3)], now keeps its item type. Previously its items were exported asoneOfan integer or anything. - Length limits of zero (
min_items,max_items,min_length,max_length) are no longer dropped from payload schemas. - An optional payload such as
Payload | Nonenow uses the examples declared onPayloadinstead of a randomly generated one. - A payload given as a type name resolved through the application's
signature_namespacenow gets a generated example. Previously the example was omitted with an "Unsupported type" warning. - A
Nonedefault on an optional field such asint | None = Noneis now exported only on the field itself. Its non-null members, including shared enum components, no longer carry a contradictorydefault: null. - Payload schema errors are easier to read: they carry a single
500:prefix, show the payload type by name instead of its full field definition, and a failing component names only the payloads that use it. websocket_listeneroperations and their inferred messages are now named after the handler function, for examplechat_receiveandchat_send. Previously every listener was namedListenerHandler_receiveorListenerHandler_send, numbered_2,_3in route order, sostrict_uniqueness=Truefailed on any app with two listeners. This is a breaking change for anyone matching the old operation or message keys.- Operations added by
asyncapi_operationorasyncapi_messagenow get the handler'ssummary,description,operation_idand docstring when the decorator sets none. Decorator values still win. asyncapi_operation(messages=...)andasyncapi_messagenow merge their messages in either stacking order. Previouslymessages=silently dropped messages added byasyncapi_messageplaced below it. Declaring the same message name twice now raisesValueErrorinstead of keeping only the last declaration.OperationDefinitionnow accepts an action in any case or with surrounding spaces, such as" Send ", as the decorators already did. Previously it raisedValueError.AsyncAPIConfignow rejects an unsupportedspec_versionsuch as"3.0"withValueError. Previously the value was written into the document unchecked.- Registering a second
AsyncAPIPluginon one application now raisesImproperlyConfiguredExceptionat startup, naming both docs paths. Previously both docs sites shared fixed route names, so one docs page could link to the other's document and assets, including a guarded one. Use one plugin per application. DocsConfignow rejects apathat the application root, such as"/"or"", withValueError. Previously the docs fallback route became the application's 404 page and the docs guards applied to every unmatched request.- The interactive console now opens for payloads typed
[object, null]and foroneOforanyOfunions whose members are all objects or arrays. Previously these operations showed "Interactive sending is unavailable".
0.2.0¶
This release redesigns the plugin around native Litestar components and packaged upstream rendering. See the migration guide for imports, configuration mappings and wire changes.
- Default to AsyncAPI 3.1, retain explicit 3.0, and correct Draft07 tuple output, examples, security references, null preservation and operation map keys.
- Reuse native Litestar schema generation, DTOs, encoders, routing, CLI and JSON/YAML render plugins. Remove the duplicate schema engine and unused shims.
- Discover finalized routes, preserve application-relative directions, and add typed explicit contracts with multiple messages, traits, replies and provenance.
- Bind cached documents to one application and return defensive public copies.
- Package AsyncAPI React component 3.2.1 with React 18.3.1 and optional Scalar 1.69.2. Scalar remains opt-in due to demonstrated schema-display gaps.
- Replace the bespoke playground with optional upstream asyncapi-ws-plugin 0.1.0 interaction. Validation is advisory; intentionally invalid input can be sent.
- Relocate UI sources and frontend tests to
tools/frontend/, keeping the repository root clean. - Isolate Playwright output artifacts into
.tmp/test-results. - Uncap the Litestar version constraint to
litestar>=2.24.0without a major-version ceiling. - Add headless JSON/YAML export and installed-wheel validation across Python 3.10–3.14 with Litestar 2.24 as the supported minimum.
0.1.0¶
- Initial release with AsyncAPI support for Litestar applications.