From 563fbf8e772d08f4d93240ab50b9d6c420843f78 Mon Sep 17 00:00:00 2001 From: MatthiasDurivet <58637306+MatthiasDurivet@users.noreply.github.com> Date: Sun, 19 Nov 2023 22:56:28 +0100 Subject: [PATCH] Update the import statements for the cookbook snippets (#1805) Updates the import statements on https://connexion.readthedocs.io/en/stable/cookbook.html A few of the import statements were missing, or didn't match the example code because they imported at the wrong depth. This should make the code in the cookbook copy-pasteable. --------- Co-authored-by: Robbe Sneyders --- docs/cookbook.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/cookbook.rst b/docs/cookbook.rst index eaac7b470..ce4382457 100644 --- a/docs/cookbook.rst +++ b/docs/cookbook.rst @@ -16,13 +16,15 @@ Starlette. You can add it to your application, ideally in front of the ``Routing :sync: AsyncApp .. code-block:: python + + from pathlib import Path from connexion import AsyncApp from connexion.middleware import MiddlewarePosition from starlette.middleware.cors import CORSMiddleware - app = connexion.AsyncApp(__name__) + app = AsyncApp(__name__) app.add_middleware( CORSMiddleware, @@ -48,13 +50,15 @@ Starlette. You can add it to your application, ideally in front of the ``Routing :sync: FlaskApp .. code-block:: python + + from pathlib import Path from connexion import FlaskApp from connexion.middleware import MiddlewarePosition from starlette.middleware.cors import CORSMiddleware - app = connexion.FlaskApp(__name__) + app = FlaskApp(__name__) app.add_middleware( CORSMiddleware, @@ -80,10 +84,12 @@ Starlette. You can add it to your application, ideally in front of the ``Routing :sync: ConnexionMiddleware .. code-block:: python + + from pathlib import Path from asgi_framework import App from connexion import ConnexionMiddleware - from connexion.lifecycle import ConnexionRequest, ConnexionResponse + from starlette.middleware.cors import CORSMiddleware app = App(__name__) app = ConnexionMiddleware(app)