RustAPI OpenAPI
Automated API specifications and Swagger UI integration.
ℹ️ 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: It uses
utoipato generate JSON Schemas for your Rust structs. - Spec Build: At runtime, it assembles the full OpenAPI 3.0 JSON specification.
- UI Serve: It embeds the Swagger UI assets and serves them at your specified path.
Customization
You can inject custom security schemes or info into the spec via the RustApi builder.
new
.api_name
.api_version
.docs
.run
.await