{"library":"connexion","title":"Connexion","description":"Connexion is a modern Python web framework that facilitates API-first development using OpenAPI (formerly Swagger) specifications. It automatically handles routing, request validation, authentication, parameter parsing, and response serialization based on your specification. Version 3.3.0 is the latest stable release, offering a modular, ASGI-compatible architecture with support for both Flask (WSGI) and Starlette (ASGI) backends. The library maintains an active release cadence, frequently publishing updates and new features.","status":"active","version":"3.3.0","language":"en","source_language":"en","source_url":"https://github.com/spec-first/connexion","tags":["api","openapi","swagger","flask","starlette","web framework","asgi","wsgi","spec-first"],"install":[{"cmd":"pip install connexion","lang":"bash","label":"Base Installation"},{"cmd":"pip install connexion[flask]","lang":"bash","label":"With Flask Backend"},{"cmd":"pip install connexion[starlette]","lang":"bash","label":"With Starlette (ASGI) Backend"},{"cmd":"pip install connexion[swagger-ui]","lang":"bash","label":"With Swagger UI"},{"cmd":"pip install connexion[uvicorn]","lang":"bash","label":"With Uvicorn (for development server)"}],"dependencies":[{"reason":"Core dependency for version parsing, explicitly added in v2.15.1.","package":"packaging","optional":false},{"reason":"Optional backend for synchronous (WSGI) applications, via `FlaskApp`.","package":"Flask","optional":true},{"reason":"Optional backend for asynchronous (ASGI) applications, via `AsyncApp`.","package":"Starlette","optional":true},{"reason":"Optional dependency to run Connexion applications (especially `AsyncApp`) in development.","package":"uvicorn","optional":true},{"reason":"Optional dependency to enable the interactive Swagger UI.","package":"swagger-ui-bundle","optional":true}],"imports":[{"note":"AsyncApp is the recommended standalone application for new ASGI projects in v3+. For Flask-based apps, use FlaskApp.","wrong":"from connexion import App # App is alias for FlaskApp unless explicitly configured otherwise in older versions","symbol":"AsyncApp","correct":"from connexion import AsyncApp"},{"note":"Used for Flask-based (WSGI) applications, especially when migrating from Connexion 2.x.","symbol":"FlaskApp","correct":"from connexion import FlaskApp"},{"note":"Use to wrap an existing ASGI or WSGI application with Connexion's spec-first capabilities.","symbol":"ConnexionMiddleware","correct":"from connexion import ConnexionMiddleware"},{"note":"The global request object. In v3, this is a Starlette Request when using AsyncApp, unlike Flask Request in v2.x.","symbol":"request","correct":"from connexion import request"}],"quickstart":{"code":"import connexion\nfrom pathlib import Path\n\n# app.py\n\ndef get_hello():\n    return {\"message\": \"Hello from Connexion!\"}, 200\n\n# Create the Connexion app using AsyncApp for ASGI compatibility\n# and look for the OpenAPI spec in the current directory.\napp = connexion.AsyncApp(__name__, specification_dir='.')\n\n# Add the API defined in openapi.yaml\napp.add_api('openapi.yaml')\n\n# To run the application (requires 'pip install connexion[uvicorn]')\n# if __name__ == \"__main__\":\n#     import uvicorn\n#     uvicorn.run(app, host=\"0.0.0.0\", port=8080)\n\n# For external running (e.g., via command line: uvicorn app:app --reload)\n# Define your OpenAPI spec in openapi.yaml in the same directory:\n# openapi: 3.0.0\n# info:\n#   title: Simple Hello API\n#   version: 1.0.0\n# paths:\n#   /hello:\n#     get:\n#       operationId: app.get_hello  # Links to the get_hello function in app.py\n#       responses:\n#         '200':\n#           description: A greeting\n#           content:\n#             application/json:\n#               schema:\n#                 type: object\n#                 properties:\n#                   message:\n#                     type: string","lang":"python","description":"This quickstart demonstrates how to create a simple 'Hello World' API using Connexion's `AsyncApp` (ASGI backend). It defines an API using an `openapi.yaml` specification file and links an operation to a Python function. The application can be run using `uvicorn` (e.g., `uvicorn app:app --reload` from the command line, assuming the Python file is named `app.py`). Ensure `openapi.yaml` is in the same directory as `app.py`."},"warnings":[{"fix":"For new projects, use `connexion.AsyncApp` and `pip install connexion[starlette]`. For migrating from 2.x, consider switching to `AsyncApp` or explicitly use `connexion.FlaskApp` and `pip install connexion[flask]`. Review the official migration guide for detailed steps.","message":"Connexion 3.x introduced fundamental changes by adopting the ASGI interface, dropping Aiohttp support entirely. This significantly changes how applications are created and run, favoring `AsyncApp` (Starlette-based) for new asynchronous projects and `FlaskApp` (Flask-based) for WSGI compatibility or migration.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Adjust code that directly accesses `connexion.request` attributes to be compatible with Starlette's `Request` object if using `AsyncApp`. If relying on Flask-specific request features, ensure you are using `FlaskApp`.","message":"The global `connexion.request` object now represents a Starlette `Request` when using `AsyncApp` in Connexion 3.x, instead of a Flask `Request` as in 2.x. This impacts direct access to request attributes and methods.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Upgrade your Python environment to 3.9 or higher. The current PyPI metadata indicates `>=3.9, <4.0`.","message":"Python 3.6 support was dropped in Connexion 3.x, and the minimum required Python version is now 3.9.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Update your application initialization to pass `uri_parser_class` and `jsonifier` directly as keyword arguments: `app = AsyncApp(__name__, uri_parser_class=MyParser, jsonifier=MyJsonifier)` or `app.add_api('spec.yaml', uri_parser_class=MyParser)`.","message":"Connexion 3.x changed how `uri_parser_class` and `jsonifier` are passed. They are now arguments directly to the `App` constructor or `add_api()` method, rather than through an `options` dictionary or by setting attributes on the `Api` object.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Ensure your API implementation explicitly returns data in the format matching one of the declared content types in your OpenAPI specification, especially for endpoints with multiple `produces` entries.","message":"Connexion 3.x no longer attempts to guess a content type for response serialization if multiple content types are defined in the OpenAPI specification for a given response.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-06T00:00:00.000Z","next_check":"2026-07-05T00:00:00.000Z"}