Skip to content

Commit

Permalink
Update the import statements for the cookbook snippets (#1805)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
MatthiasDurivet and RobbeSneyders authored Nov 19, 2023
1 parent 165a915 commit 563fbf8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docs/cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit 563fbf8

Please sign in to comment.