Repository navigation
v0.1.0 - Initial MVP Release
AsyncAPI 3.0 Specification Generation for Rust
Generate AsyncAPI documentation directly from your Rust code using procedural macros.
✨ Features
#[derive(ToAsyncApiMessage)]- Generate message metadata and JSON schemas from Rust types#[derive(AsyncApi)]- Generate complete AsyncAPI specifications#[asyncapi_messages(...)]- Automatically integrate message types into specs- Full schemars integration - JSON Schema generation from Rust types
- Server, channel, and operation definitions - Complete AsyncAPI 3.0 support
- Binary protocol support -
triggers_binaryattribute for binary messages - Framework integration - Examples for actix-ws, axum, and tungstenite
- 9 comprehensive examples - From simple to real-world usage
- Complete documentation - Full rustdoc on docs.rs
🚀 Getting Started
Add to your `Cargo.toml`:
```toml
[dependencies]
asyncapi-rust = "0.1"
serde = { version = "1.0", features = ["derive"] }
schemars = { version = "0.8", features = ["derive"] }
```
Quick example:
```rust
use asyncapi_rust::{AsyncApi, ToAsyncApiMessage, schemars::JsonSchema};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, JsonSchema, ToAsyncApiMessage)]
#[serde(tag = "type")]
pub enum ChatMessage {
#[serde(rename = "user.join")]
UserJoin { username: String, room: String },
}
#[derive(AsyncApi)]
#[asyncapi(title = "Chat API", version = "1.0.0")]
#[asyncapi_messages(ChatMessage)]
struct ChatApi;
```
📦 Published Crates
- asyncapi-rust - Main crate
- asyncapi-rust-codegen - Proc macros
- asyncapi-rust-models - Runtime models
📖 Documentation
🎯 What's Included
Core Functionality
- Message metadata generation from Rust types
- JSON Schema generation via schemars
- Complete AsyncAPI 3.0 spec generation
- Automatic message integration into specs
- serde attribute support (rename, tag, etc.)
Advanced Features
- Binary protocol support
- Server definitions
- Channel definitions
- Operation definitions (send/receive)
- Helper attributes for documentation
Examples
simple.rs- Basic message typeschat_api.rs- Complete specasyncapi_derive.rs- AsyncApi derive usagegenerate_spec_file.rs- File generationfull_asyncapi_derive.rs- All featuresmessage_integration.rs- Message integrationactix_websocket.rs- actix-web integrationaxum_websocket.rs- axum integrationframework_integration_guide.rs- Framework guide
🧪 Testing
- 20 unit tests
- 11 integration tests
- 10 documentation tests
- Clippy clean
- MSRV: Rust 1.85
📝 Release Notes
This is the initial MVP release with complete functionality for generating AsyncAPI 3.0 specifications from Rust code. The API is not yet stable and may change in future releases.
Key Additions in This Release
- Complete AsyncAPI 3.0 models
- ToAsyncApiMessage derive macro
- AsyncApi derive macro
- Message integration with #[asyncapi_messages(...)]
- Full schemars integration
- Comprehensive documentation
- Real-world framework examples
🙏 Acknowledgments
Inspired by utoipa for OpenAPI generation and the AsyncAPI Initiative.
License: MIT OR Apache-2.0
Author: Mark Lilback