{"id":1232,"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":"python","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"},{"fix":"Ensure that the OpenAPI specification file exists at the path provided to `app.add_api()` and is accessible by the application. Verify the file path is correct relative to the application's working directory or use an absolute path.","message":"The application failed to start because the OpenAPI specification file (e.g., `openapi.yaml`) was not found at the specified path during `app.add_api()`. This is a critical error preventing Connexion from loading your API definition.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'3.3.0':37 'activ':64 'api':12,73 'api-first':11 'architectur':49 'asgi':47,58,80 'asgi-compat':46 'authent':26 'automat':21 'backend':59 'base':32 'cadenc':66 'compat':48 'connexion':1,2 'develop':14 'facilit':10 'featur':72 'first':13,84 'flask':54,76 'former':17 'framework':8,79 'frequent':67 'handl':22 'latest':40 'librari':61 'maintain':62 'modern':5 'modular':45 'new':71 'offer':43 'openapi':16,74 'paramet':27 'pars':28 'publish':68 'python':6 'releas':42,65 'request':24 'respons':30 'rout':23 'serial':31 'spec':83 'spec-first':82 'specif':19,35 'stabl':41 'starlett':57,77 'support':51 'swagger':18,75 'updat':69 'use':15 'valid':25 'version':36 'web':7,78 'wsgi':55,81","created_at":"2026-04-06T16:55:42.073809+00:00","updated_at":"2026-04-16T03:38:05.038211+00:00","problems":[{"fix":"Update your import statements to reflect the new Connexion 3.x structure, for example, use `from connexion import FlaskApp` instead of `from connexion.apps.flask_app import FlaskApp`. Ensure `connexion` is installed with the `flask` extra: `pip install 'connexion[flask]'`.","cause":"This error typically occurs when migrating from Connexion 2.x to 3.x, or when using generated code from older versions, as the internal module structure changed significantly in Connexion 3.x.","error":"ModuleNotFoundError: No module named 'connexion.apps.flask_app'"},{"fix":"For request bodies, add the `x-body-name: <parameter_name>` extension to your OpenAPI `requestBody` schema to explicitly name the parameter that Connexion should pass to your handler function. Ensure parameter names in your Python function signature exactly match those defined in the OpenAPI spec.","cause":"Connexion could not correctly map a parameter from the incoming HTTP request (often a request body or a complex query/form parameter) to the corresponding argument in your Python handler function.","error":"TypeError: <operation_id>() missing 1 required positional argument: '<parameter_name>'"},{"fix":"Carefully check the `operationId` in your OpenAPI specification for typos and ensure it exactly matches the Python function name. Verify that the Python module path (specified in `x-swagger-router-controller` or derived from `operationId`) is correct and resolvable from your application's execution context, and that the function is indeed defined and importable within that module.","cause":"Connexion cannot find the Python function specified by the `operationId` in your OpenAPI document within the provided module path, usually due to a typo in the `operationId` or an incorrect module path.","error":"AttributeError: module '<module_name>' has no attribute '<operation_id>'"},{"fix":"Ensure your `connexion.FlaskApp` instance is assigned to a top-level variable named `app` or `application` in your main application module (e.g., `app = connexion.FlaskApp(__name__)`). Alternatively, set the `FLASK_APP` environment variable to point to your specific application instance (e.g., `export FLASK_APP=your_module:your_app_instance_name`).","cause":"When running a Connexion application with the Flask backend, Flask's CLI or a WSGI server cannot locate the application instance if it's not named 'app' or 'application' at the top level of the specified module, or if the `FLASK_APP` environment variable is not set correctly.","error":"connexion: Failed to find Flask application or factory in module \"<module_name>\""}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.3.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://connexion.readthedocs.io","github":"https://github.com/spec-first/connexion","docs":null,"changelog":null,"pypi":"https://pypi.org/project/connexion/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-28","install_tag":"verified"}}