Skip to content

Commit

Permalink
Switch to sphinx_design
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeSneyders committed May 2, 2023
1 parent 2e3eb95 commit e518a65
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 28 deletions.
73 changes: 45 additions & 28 deletions docs/apps_and_apis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,25 @@ built using either the :code:`AsyncApp` or :code:`FlaskApp`.
Creating your application
-------------------------

.. tabs::
.. tab-set::

.. group-tab:: AsyncApp
.. tab-item:: AsyncApp
:sync: AsyncApp

.. code-block:: python
from connexion import AsyncApp
app = AsyncApp(__name__)
.. collapse:: View a detailed reference of the options accepted by the AsyncApp
.. dropdown:: View a detailed reference of the options accepted by the :code:`AsyncApp`
:icon: eye

.. autoclass:: connexion.AsyncApp
:noindex:

.. group-tab:: FlaskApp
.. tab-item:: FlaskApp
:sync: FlaskApp

.. note::
To leverage the :code:`FlaskApp`, make sure you install connexion using the
Expand All @@ -43,12 +46,14 @@ Creating your application
app = FlaskApp(__name__)
.. collapse:: View a detailed reference of the options accepted by the FlaskApp
.. dropdown:: View a detailed reference of the options accepted by the :code:`FlaskApp`
:icon: eye

.. autoclass:: connexion.FlaskApp
:noindex:

.. group-tab:: ConnexionMiddleware
.. tab-item:: ConnexionMiddleware
:sync: ConnexionMiddleware

.. code-block:: python
Expand All @@ -71,7 +76,9 @@ Creating your application
asgi_app = WSGIMiddleware(wsgi_app)
app = ConnexionMiddleware(app)
.. collapse:: View a detailed reference of the options accepted by the ConnexionMiddleware
.. dropdown:: View a detailed reference of the options accepted by the
:code:`ConnexionMiddleware`
:icon: eye

.. autoclass:: connexion.ConnexionMiddleware
:noindex:
Expand All @@ -89,27 +96,29 @@ When an argument is provided both on the App and the API, the API value will tak
app.add_api("openapi.yaml")
.. collapse:: View a detailed reference of the options accepted by the add_api() method.
.. dropdown:: View a detailed reference of the options accepted by the :code:`add_api()` method
:icon: eye

.. tabs::
.. tab-set::

.. group-tab:: AsyncApp
.. tab-item:: AsyncApp
:sync: AsyncApp

.. autofunction:: connexion.AsyncApp.add_api
:noindex:

.. group-tab:: FlaskApp
.. tab-item:: FlaskApp
:sync: FlaskApp

.. autofunction:: connexion.FlaskApp.add_api
:noindex:

.. group-tab:: ConnexionMiddleware
.. tab-item:: ConnexionMiddleware
:sync: ConnexionMiddleware

.. autofunction:: connexion.ConnexionMiddleware.add_api
:noindex:

|
Running your application
------------------------

Expand All @@ -136,53 +145,61 @@ import string. In most cases, this can be achieved as follows:
app.run(f"{Path(__file__).stem}:app")
.. collapse:: View a detailed reference of the options accepted by the run() method.
.. dropdown:: View a detailed reference of the options accepted by the :code:`run()` method
:icon: eye

.. tabs::
.. tab-set::

.. group-tab:: AsyncApp
.. tab-item:: AsyncApp
:sync: AsyncApp

.. autofunction:: connexion.AsyncApp.run
:noindex:

.. group-tab:: FlaskApp
.. tab-item:: FlaskApp
:sync: FlaskApp

.. autofunction:: connexion.FlaskApp.run
:noindex:

.. group-tab:: ConnexionMiddleware
.. tab-item:: ConnexionMiddleware
:sync: ConnexionMiddleware

.. autofunction:: connexion.ConnexionMiddleware.run
:noindex:

|
Full class reference
--------------------

.. tabs::
.. tab-set::

.. group-tab:: AsyncApp
.. tab-item:: AsyncApp
:sync: AsyncApp

.. collapse:: View a complete detailed reference of the AsyncApp
.. dropdown:: View a detailed reference of the :code:`AsyncApp`
:icon: eye

.. autoclass:: connexion.AsyncApp
:members:
:undoc-members:
:inherited-members:

.. group-tab:: FlaskApp
.. tab-item:: FlaskApp
:sync: FlaskApp

.. collapse:: View a complete detailed reference of the FlaskApp
.. dropdown:: View a detailed reference of the :code:`FlaskApp`
:icon: eye

.. autoclass:: connexion.FlaskApp
:members:
:undoc-members:
:inherited-members:

.. group-tab:: ConnexionMiddleware
.. tab-item:: ConnexionMiddleware
:sync: ConnexionMiddleware

.. collapse:: View a complete detailed reference of the ConnexionMiddleware
.. dropdown:: View a detailed reference of the :code:`ConnexionMiddleware`
:icon: eye

.. autoclass:: connexion.ConnexionMiddleware
:members:
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
'sphinx.ext.autodoc',
'sphinx_tabs.tabs',
'sphinx_toolbox.collapse',
'sphinx_design',
]

autoclass_content = 'both'
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pytest-cov = "~2.12.1"
sphinx = "5.3.0"
sphinx-autoapi = "2.0.1"
sphinx-rtd-theme = "1.2.0"
sphinx_design = "0.4.1"

[build-system]
requires = ["poetry-core>=1.2.0"]
Expand Down

0 comments on commit e518a65

Please sign in to comment.