Auto-generates OpenAPI documentation for Rust REST APIs using simple procedural macros and a code-first approach.
utoipa is a Rust library that automatically generates OpenAPI 3.1 documentation from Rust code. It uses procedural macros to annotate types and handlers, eliminating manual YAML or JSON tweaking and treating code-first documentation as a first-class citizen.
Rust developers building REST APIs with web frameworks like Actix Web, Axum, or Rocket who need standards-compliant OpenAPI documentation.
Developers choose utoipa for its minimal, simple, and fast approach to auto-generating OpenAPI specs directly from code, with seamless framework integration and support for generic types and runtime modifications.
Simple, Fast, Code first and Compile time generated OpenAPI documentation for Rust
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses derive macros like #[utoipa::path] to define OpenAPI endpoints and schemas directly in Rust code, eliminating manual YAML/JSON tweaking as highlighted in the README.
Seamlessly integrates with Actix Web, Axum, and Rocket via feature flags, automatically parsing path and query parameters from framework attributes for reduced boilerplate.
Recursively collects request/response schemas from handler arguments and attributes, reducing the risk of documentation drift as types evolve.
Supports dynamic adjustments to generated OpenAPI documents using the Modify trait or direct type manipulation, allowing for post-generation tweaks.
The README admits that tuples, arrays, and slices cannot be used as generic arguments, and manually implementing ToSchema for generic types causes compile errors, restricting schema design.
Full framework integration requires enabling specific feature flags (e.g., actix_extras), which can bloat dependencies and complicate setup for multi-framework projects.
As noted in the FAQ, Swagger UI may fail in debug builds unless additional configuration (like debug-embed) is added, introducing runtime hurdles during development.