rustapi-openapi
Lens: "The Documentarian"
Philosophy: "Your API speaks for itself."
Automated API specifications and Swagger UI integration for RustAPI.
ℹ️ Note: This crate is used internally by
rustapi-rsto provide the.docs()method on the server builder.
How It Works
- Reflection: RustAPI macros collect metadata about your routes (path, method, input types, output types) at compile time
- Schema Gen: Uses
utoipato generate JSON Schemas for your Rust structs - Spec Build: At runtime, assembles the full OpenAPI 3.0 JSON specification
- UI Serve: Embeds the Swagger UI assets and serves them at your specified path
Route Metadata Macros
RustAPI provides attribute macros for enriching OpenAPI documentation:
async
Customization
Inject custom security schemes or info into the spec via the RustApi builder:
new
.api_name
.api_version
.docs
.run
.await