# juhaku/utoipa

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/juhaku-utoipa).**

3,682 stars · 329 forks · Rust · apache-2.0

## Links

- GitHub: https://github.com/juhaku/utoipa
- awesome-repositories: https://awesome-repositories.com/repository/juhaku-utoipa.md

## Topics

`auto-generated` `compile-time` `documentation` `generated` `openapi` `openapi-documentation` `openapi31` `rest` `rest-api` `rest-api-documentation` `rust` `swagger`

## Description

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.

## Tags

### Programming Languages & Runtimes

- [Documentation Macros](https://awesome-repositories.com/f/programming-languages-runtimes/documentation-macros.md) — Uses procedural macros to describe API paths, expected parameters, and possible responses directly in the code. ([source](https://docs.rs/utoipa/latest/utoipa/all.html))
- [Metadata Extraction Macros](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/metaprogramming/procedural-macros/metadata-extraction-macros.md) — Utilizes procedural macros to analyze Rust types and attributes at compile time to generate API definitions.
- [Request Parameter Parsing](https://awesome-repositories.com/f/programming-languages-runtimes/type-annotations/request-parameter-parsing.md) — Parses path, query, and request body parameters from web framework attributes using type annotations. ([source](https://docs.rs/utoipa/latest/utoipa/index.html))
- [Attribute-Based Mappings](https://awesome-repositories.com/f/programming-languages-runtimes/net-object-mapping/attribute-based-mappings.md) — Synchronizes renaming and tagging settings from serialization attributes directly into the generated OpenAPI specification. ([source](https://docs.rs/utoipa/latest/utoipa/derive.ToSchema.html))

### Web Development

- [OpenAPI Specification Generators](https://awesome-repositories.com/f/web-development/restful-apis/documentation-schemas/openapi-specification-generators.md) — Constructs complete OpenAPI specification documents including servers, endpoints, and security requirements from Rust code. ([source](https://docs.rs/utoipa/latest/utoipa/openapi/struct.OpenApiBuilder.html))
- [REST API Specifications](https://awesome-repositories.com/f/web-development/restful-apis/rest-api-specifications.md) — Generates interactive web interfaces and OpenAPI specifications to describe endpoints, request bodies, and response formats.
- [API Documentation Tools](https://awesome-repositories.com/f/web-development/api-documentation-tools.md) — Provides a complete toolset for creating machine-readable API definitions by mapping Rust types to OpenAPI schemas.
- [API Path Mappings](https://awesome-repositories.com/f/web-development/api-path-mappings.md) — Connects functions to specific HTTP methods and endpoint paths to define request routing in the specification. ([source](https://docs.rs/utoipa/latest/utoipa/attr.path.html))
- [Framework Macro Integrations](https://awesome-repositories.com/f/web-development/framework-macro-integrations.md) — Extracts paths, methods, and parameter types directly from web framework-specific macros and handler arguments. ([source](https://docs.rs/utoipa/latest/utoipa/attr.path.html))
- [Input Parameter Specifications](https://awesome-repositories.com/f/web-development/input-parameter-specifications.md) — Lists path, query, and header variables an endpoint accepts to automate input requirement specifications. ([source](https://docs.rs/utoipa/latest/utoipa/attr.path.html))
- [Request Body Documentation](https://awesome-repositories.com/f/web-development/request-body-documentation.md) — Describes the structure and requirements of incoming request bodies to ensure correct documentation of inputs. ([source](https://docs.rs/utoipa/latest/utoipa/openapi/request_body/index.html))
- [Request Payload Specifications](https://awesome-repositories.com/f/web-development/request-payload-specifications.md) — Defines the expected input payload using data types and schemas to ensure correct API request documentation. ([source](https://docs.rs/utoipa/latest/utoipa/attr.path.html))
- [Response Schema Mappings](https://awesome-repositories.com/f/web-development/response-handlers/automatic-response-mapping/response-schema-mappings.md) — Maps Rust data types to OpenAPI response objects by associating status codes and schemas with specific structures. ([source](https://docs.rs/utoipa/latest/utoipa/derive.IntoResponses.html))
- [Documentation Schemas](https://awesome-repositories.com/f/web-development/restful-apis/documentation-schemas.md) — Maps Rust data structures to OpenAPI schema objects to document request and response formats. ([source](https://docs.rs/utoipa/latest/utoipa/all.html))
- [Rust-to-OpenAPI Schema Mappers](https://awesome-repositories.com/f/web-development/restful-apis/documentation-schemas/openapi-frameworks/rust-to-openapi-schema-mappers.md) — Converts Rust structs and enums into OpenAPI compliant schemas with support for generics and polymorphism.
- [Handler Metadata Extraction](https://awesome-repositories.com/f/web-development/route-extraction-utilities/handler-metadata-extraction.md) — Extracts path parameters, query parameters, and request bodies directly from route handlers for documentation. ([source](https://docs.rs/utoipa/latest/utoipa/))
- [Request-Response Type Mapping](https://awesome-repositories.com/f/web-development/type-safe-api-schemas/request-response-type-mapping.md) — Converts Rust structs and enums into schemas and response objects to document API inputs and outputs. ([source](https://docs.rs/utoipa/latest/utoipa/))
- [API Documentation](https://awesome-repositories.com/f/web-development/api-documentation.md) — Hosts a web interface allowing users to interactively explore and test API endpoints through a browser.
- [Declarative Serialization Mappings](https://awesome-repositories.com/f/web-development/declarative-serializers/declarative-serialization-mappings.md) — Synchronizes field renaming and tagging from serialization attributes to ensure the specification matches the actual JSON output.
- [Response Format Descriptions](https://awesome-repositories.com/f/web-development/response-formatting/response-format-descriptions.md) — Provides detailed descriptions of HTTP status codes and data structures returned by API endpoints to inform clients. ([source](https://docs.rs/utoipa/latest/utoipa/attr.path.html))
- [Generic Type Support](https://awesome-repositories.com/f/web-development/restful-apis/documentation-schemas/generic-type-support.md) — Creates schemas for generic types by ensuring all parameters implement the required schema traits. ([source](https://docs.rs/utoipa/latest/utoipa/derive.ToSchema.html))
- [Multi-Response Modeling](https://awesome-repositories.com/f/web-development/restful-apis/documentation-schemas/multi-response-modeling.md) — Defines a single type to represent and document various possible HTTP responses for a single API operation. ([source](https://docs.rs/utoipa/latest/utoipa/trait.IntoResponses.html))
- [Struct-to-Parameter Mappings](https://awesome-repositories.com/f/web-development/struct-to-parameter-mappings.md) — Generates path and query parameter definitions directly from Rust structs using documentation comments. ([source](https://docs.rs/utoipa/latest/utoipa/derive.IntoParams.html))
- [Web Framework Integrations](https://awesome-repositories.com/f/web-development/web-framework-integrations.md) — Integrates with Rust web frameworks to extract route metadata and parameter types directly from handlers.

### Data & Databases

- [Code-to-Schema Generation](https://awesome-repositories.com/f/data-databases/code-to-schema-generation.md) — Analyzes Rust source code and attributes to generate external OpenAPI data validation schemas. ([source](https://docs.rs/utoipa/latest/utoipa/trait.ToSchema.html))
- [API Schema Mapping](https://awesome-repositories.com/f/data-databases/data-governance-modeling/data-modeling-schemas/api-schema-mapping.md) — Maps complex data structures, including arrays and objects, to schemas for API request and response bodies. ([source](https://docs.rs/utoipa/latest/utoipa/openapi/schema/enum.Schema.html))
- [Trait-Based](https://awesome-repositories.com/f/data-databases/data-governance-modeling/data-modeling-schemas/schema-mapping/trait-based.md) — Converts complex Rust data structures into OpenAPI schema objects through a shared interface for type conversion.
- [Automatic Specification Generators](https://awesome-repositories.com/f/data-databases/openapi-processors/automatic-specification-generators.md) — Automatically derives OpenAPI specifications and schemas from source code using procedural macros and traits. ([source](https://docs.rs/utoipa/latest/utoipa/derive.ToSchema.html))
- [OpenAPI Format Mapping](https://awesome-repositories.com/f/data-databases/custom-type-converters/openapi-format-mapping.md) — Converts specialized types, such as dates and UUIDs, into compliant OpenAPI schema formats. ([source](https://docs.rs/utoipa/latest/utoipa/index.html))

### Development Tools & Productivity

- [API Specification Analysis](https://awesome-repositories.com/f/development-tools-productivity/code-quality-analysis/automated-code-analysis-tools/api-specification-analysis.md) — Builds machine-readable definitions of endpoints and security requirements using automated code analysis. ([source](https://cdn.jsdelivr.net/gh/juhaku/utoipa@master/README.md))
- [OpenAPI Specification Generators](https://awesome-repositories.com/f/development-tools-productivity/openapi-configurations/documentation-generators/openapi-specification-generators.md) — Generates YAML and JSON OpenAPI specifications from Rust code using procedural macros and traits.
- [Interactive Documentation Interfaces](https://awesome-repositories.com/f/development-tools-productivity/openapi-configurations/documentation-generators/openapi-specification-generators/interactive-documentation-interfaces.md) — Hosts an interactive web interface that renders OpenAPI specifications for exploring and testing endpoints. ([source](https://cdn.jsdelivr.net/gh/juhaku/utoipa@master/README.md))

### Software Engineering & Architecture

- [Response Specifications](https://awesome-repositories.com/f/software-engineering-architecture/api-specification-definitions/response-specifications.md) — Defines expected endpoint outputs, including HTTP status codes and associated data structures. ([source](https://docs.rs/utoipa/latest/utoipa/openapi/response/index.html))
- [Type-Safe API Schemas](https://awesome-repositories.com/f/software-engineering-architecture/data-schema-definitions/type-safe-api-schemas.md) — Maps complex Rust data structures, including generics and polymorphism, into compliant OpenAPI schema objects.
- [Polymorphic Schema Mapping](https://awesome-repositories.com/f/software-engineering-architecture/data-schema-validation/data-type-validation/object-shape-validation/schema-composition/polymorphic-schema-mapping.md) — Creates composite object schemas using selection patterns to handle endpoints returning multiple different types. ([source](https://docs.rs/utoipa/latest/utoipa/openapi/schema/enum.Schema.html))
- [Recursive Type Resolution](https://awesome-repositories.com/f/software-engineering-architecture/generic-type-definitions/generic-type-resolution/recursive-type-resolution.md) — Prevents infinite loops during schema generation by tracking type references and marking termination points for cyclic structures.
- [Framework-Specific Integrations](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/framework-specific-integrations.md) — Maps framework-specific route metadata and handler arguments into a standardized representation for specification generation.
- [Nested API Definitions](https://awesome-repositories.com/f/software-engineering-architecture/modular-program-composition/nested-api-definitions.md) — Supports organizing large API specifications by nesting smaller, modular API definitions within a root instance. ([source](https://docs.rs/utoipa/latest/utoipa/derive.OpenApi.html))
- [Recursive Data Schemas](https://awesome-repositories.com/f/software-engineering-architecture/recursive-data-schemas.md) — Prevents infinite loops in the schema tree by marking specific fields to stop recursion during type referencing. ([source](https://docs.rs/utoipa/latest/utoipa/derive.ToSchema.html))
- [Reusable Response Components](https://awesome-repositories.com/f/software-engineering-architecture/reusable-component-architectures/reusable-response-components.md) — Generates reusable response components from data structures by mapping types and comments to the specification. ([source](https://docs.rs/utoipa/latest/utoipa/derive.ToResponse.html))

### Networking & Communication

- [Specification Type Translations](https://awesome-repositories.com/f/networking-communication/url-parameter-parsers/automatic-parameter-mapping/type-safe-parameter-mapping/specification-type-translations.md) — Translates internal Rust data types into standard OpenAPI formats for consistent external parameter documentation. ([source](https://docs.rs/utoipa/latest/utoipa/trait.IntoParams.html))

### Security & Cryptography

- [API Authentication Schemes](https://awesome-repositories.com/f/security-cryptography/api-authentication-schemes.md) — Specifies authentication methods such as API keys and OAuth2 flows to secure documented endpoints. ([source](https://docs.rs/utoipa/latest/utoipa/openapi/security/index.html))
- [API Authentication Schemes](https://awesome-repositories.com/f/security-cryptography/basic-authentication/api-authentication-schemes.md) — Defines authentication schemes such as OAuth2 and API keys within the service specification.
