utoipa is a Rust API documentation tool used to generate machine-readable OpenAPI specifications. It functions as a specification generator and schema mapper that converts Rust structs and enums into compliant OpenAPI schemas.
The project distinguishes itself by using procedural macros and traits to automate metadata extraction from code. It supports complex data modeling, including generics, polymorphism, and recursive type resolution, while synchronizing field renaming and tagging from serialization attributes. It also enables the composition of modular specifications, allowing multiple small API definitions to be nested into a single root instance.
The toolset covers a broad range of capabilities, including the definition of security schemes like OAuth2 and API keys, the mapping of request and response bodies, and the configuration of numeric value constraints. It provides integration with web frameworks to extract route metadata and parameter types directly from handlers. Additionally, it can export specifications in YAML format and host an interactive web interface for exploring and testing endpoints.