lilydocs
HTTP APIWebSocketConsumer
API contracts2 min read

AsyncAPI metadata

Register controller and action descriptions as metadata while keeping this version's document-generation boundary explicit.

Lily WebSocket registers controller and operation metadata through asyncapi(...) attributes. This version has no built-in AsyncAPI JSON generator, publishing endpoint, or UI.

Add descriptions#

Metadata layout
#[derive(WebSocketController)]
#[namespace("orders")]
#[asyncapi(tag = "orders", summary = "Sipariş mesajları")]
struct OrdersController;

#[websocket_controller]
impl OrdersController {
    #[message("changed")]
    #[asyncapi(
        documented,
        summary = "Sipariş değişti",
        description = "Doğrulanmış kullanıcının sipariş bildirimi",
        operation_id = "orderChanged",
        security = "session",
        deprecated = false
    )]
    async fn changed(&self) -> Result<NoReply, WebSocketActionError> {
        Ok(NoReply)
    }
}

This snippet shows metadata placement; add the controller constructor and facade imports. A compiled, complete metadata example appears in the TechniquesController file. Descriptions should reflect the application's actual action behavior.

Supported fields#

Field Use
documented Mark as documented
skip Mark as outside documentation coverage
tag, security Repeatable classification and security metadata
summary, description Short and detailed descriptions
operation_id Operation identifier
deprecated Deprecation information

Skip cannot be combined with documentation fields. Duplicate scalar or conflicting metadata causes a compile-time error. Registrations carry Unspecified, Documented, or Skipped states.

No additional enforcement#

security = "session" does not install identity middleware or a guard. Apply authentication and authorization separately. Naming a capability in metadata does not change the wire protocol or runtime behavior.

Document-generation boundary#

There is no public AsyncApiService, builder publishing setting, complete DTO schema export, or built-in document endpoint. Do not transfer the HTTP OpenAPI flow directly to this crate. This is why the page is called AsyncAPI metadata.

You can maintain metadata describing your application contract now. A complete generator/export requires a separately supported framework addition; do not invent a public API from private registration structures.

Sources for this page v0.1.0

This guide is based on the reviewed framework commit.

QUICK START
Documentation
Source code