Skip to content

Commit

Permalink
Add aiohttp-apispec auto generation of OpenAPI docs & specs
Browse files Browse the repository at this point in the history
  • Loading branch information
MHHukiewitz committed Mar 19, 2024
1 parent 1234b2c commit 2738b0c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ setup_requires =
install_requires =
aio_pika==9.1.3
aiocache==0.12.2
aiohttp==3.8.4
aiohttp-apispec==2.2.3
aiohttp-cors==0.7.0
aiohttp-jinja2==1.5
aiohttp==3.8.4
aioipfs@git+https://github.com/aleph-im/aioipfs.git@d671c79b2871bb4d6c8877ba1e7f3ffbe7d20b71
alembic==1.12.1
aleph-message==0.4.2
aleph-message==0.4.4
aleph-p2p-client@git+https://github.com/aleph-im/p2p-service-client-python@2c04af39c566217f629fd89505ffc3270fba8676
aleph-pytezos@git+https://github.com/aleph-im/aleph-pytezos.git@32dd1749a4773da494275709060632cbeba9a51b
asyncpg==0.28.0
Expand Down
12 changes: 12 additions & 0 deletions src/aleph/web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import jinja2
import pkg_resources
from aiohttp import web
from aiohttp_apispec import (
setup_aiohttp_apispec,
)

from aleph.web.controllers.routes import register_routes

Expand Down Expand Up @@ -60,4 +63,13 @@ def create_aiohttp_app() -> web.Application:

init_cors(app)

setup_aiohttp_apispec(
app=app,
title="Aleph",
version="v0",
url="/api/docs/json",
swagger_path="/api/docs",
swagger_ui_static_path="/api/docs/ui",
)

return app

0 comments on commit 2738b0c

Please sign in to comment.