OpenAPI#
Litestar has first class OpenAPI support offering the following features:
Automatic OpenAPI 3.1.0 Schema generation, which is available as both YAML and JSON.
Builtin support for static documentation site generation using several different libraries.
Simple configuration using pydantic based classes.
Litestar includes a complete implementation of the latest version of the OpenAPI specification
using Python dataclasses. This implementation is used as a basis for generating OpenAPI specs, supporting builtins including
dataclasses
and TypedDict
, as well as Pydantic models and any 3rd party entities for which a plugin is implemented.
This is also highly configurable - and users can customize the OpenAPI spec in a variety of ways - ranging from passing configuration globally, to settings specific kwargs on route handler decorators.
- Configuring schema generation
- Configuring schema generation on a route handler
- Accessing the OpenAPI schema in code
- Customizing Pydantic model schemas
- Customizing
Operation
class - OpenAPI UI Plugins
- Using OpenAPI UI Plugins
- Configuring OpenAPI UI Plugins
- Configuring the OpenAPI Root Path
- Backward Compatibility
- Building your own OpenAPI UI Plugin
- Interacting with the
Router
- OAuth2 in Swagger UI
- Customizing the OpenAPI UI
- CDN and offline file support