Why Did I Build This?
"Mainstream Rust OpenAPI crates (like utoipa) introduce significant boilerplate, demanding excessive trait implementations and macro configurations that clutter the codebase. To eliminate this friction, I engineered a bespoke proc-macro engine that parses the AST and automatically collects distributed route/schema definitions at compile-time. I published this engine on crates.io to provide a drop-in dependency that allows other engineers to instantly spin up highly optimized, tabbed Swagger UI interfaces with absolute minimal configuration."
Architecture & Decisions
The core operates on the `proc-macro` layer, utilizing `syn` and `quote` to deeply parse the Rust Abstract Syntax Tree (AST). Macros (`#[register_api]` and `#[derive(ApiSchema)]`) statically submit structural metadata via `inventory::submit!`. During Actix-Web runtime initialization, `ApiRegistry::new()` iterates over the globally collected statics and compiles them into a structured OpenAPI 3.0.0 JSON payload. The presentation layer serves an embedded HTML payload that dynamically injects a custom React hook (`TabbedResponsesPlugin`) into the SwaggerUIBundle, actively overriding the default DOM representation of HTTP responses.
Key Features
- 01.Packaged and published as a fully isolated, drop-in Cargo crate dependency
- 02.Recursive AST type lexing for nested Rust generics (Option, Vec, Uuid, DateTime mapping natively to OpenAPI schemas)
- 03.Autonomous, decentralized route and schema registration via the `inventory` crate, bypassing central boilerplate constraints
- 04.Seamless, one-line Actix-Web `web::ServiceConfig` middleware integration
- 05.Custom Tabbed HTTP Status UI plugin that hooks directly into the Swagger UI React component tree at runtime