Connexion builds Python APIs from an OpenAPI specification first. It wires routes, validation, auth, and serialization to your Python functions and can host a Swagger UI.
Overview
Connexion is a Python web framework centered on spec-first and API-first development. You describe endpoints in OpenAPI or Swagger, and Connexion registers routes, validates requests and responses, and maps operations to Python callables via operationId.
It can run as a standalone AsyncApp, a Flask-backed app, or middleware around existing ASGI or WSGI applications. Optional extras add Swagger UI, uvicorn for local run(), and Flask compatibility. Security handlers cover basic, bearer JWT, API keys, and OAuth2 flows described in the spec.
A CLI supports running or mocking a specification file, which helps teams agree on contracts before implementation. Request handling includes parameter injection without manually reading request objects, and responses can be plain Python values that Connexion serializes.
Production deployment typically uses an ASGI server such as uvicorn or gunicorn with a uvicorn worker. Documentation emphasizes contract testing and parallel client/server work compared with code-first frameworks that generate specs afterward.
Key features
- Automatic routes from OpenAPI
- Request and response validation
- Swagger UI console optional extra
- AsyncApp and FlaskApp modes
- ASGI and WSGI middleware wrapping
- Multiple authentication schemes
- CLI to run or mock specs
- Parameter injection from operations
Use cases
- Implement REST APIs strictly from OpenAPI
- Share machine-readable API contracts with clients
- Add validation layer to existing Flask apps
- Prototype APIs with interactive Swagger UI
- Enforce auth rules declared in the spec