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 <robbe.sneyders@gmail.com>
This commit is contained in:
MatthiasDurivet
2023-11-19 22:56:28 +01:00
committed by GitHub
parent 165a91511b
commit 563fbf8e77

View File

@@ -17,12 +17,14 @@ Starlette. You can add it to your application, ideally in front of the ``Routing
.. 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,
@@ -49,12 +51,14 @@ Starlette. You can add it to your application, ideally in front of the ``Routing
.. 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,
@@ -81,9 +85,11 @@ Starlette. You can add it to your application, ideally in front of the ``Routing
.. 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)