Connexion Middleware Stack

Connexion 3 introduces a stack of pluggable ASGI middlewares that handle exceptions, server errors, lifespan, security, routing, request validation, response validation, Swagger UI, and context propagation. The middleware stack can be applied to any ASGI or WSGI application via ConnexionMiddleware.

API entry from apis.yml

apis.yml Raw ↑
aid: connexion:middleware
name: Connexion Middleware Stack
description: Connexion 3 introduces a stack of pluggable ASGI middlewares that handle exceptions, server
  errors, lifespan, security, routing, request validation, response validation, Swagger UI, and context
  propagation. The middleware stack can be applied to any ASGI or WSGI application via ConnexionMiddleware.
humanURL: https://connexion.readthedocs.io/en/latest/middleware.html
baseURL: https://connexion.readthedocs.io
tags:
- ASGI
- Middleware
- WSGI
properties:
- type: Documentation
  url: https://connexion.readthedocs.io/en/latest/middleware.html
- type: Reference
  url: https://github.com/spec-first/connexion/tree/main/connexion/middleware
x-features:
- Routing, security, request, and response validation middleware
- SwaggerUIMiddleware for interactive docs
- LifespanMiddleware for startup and shutdown hooks
- ContextMiddleware to propagate request context
x-useCases:
- Add Connexion validation to FastAPI or Starlette
- Wrap an existing WSGI application without rewriting handlers
- Customize the middleware stack for a specific deployment