Skip to content

Commit 7398eab

Browse files
MHHukiewitzodesenfans
authored andcommitted
Add aiohttp-apispec auto generation of OpenAPI docs & specs
1 parent 3f27e06 commit 7398eab

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dependencies = [
2525
"aiocache==0.12.3",
2626
"aiofiles==24.1.0",
2727
"aiohttp==3.12.15",
28+
"aiohttp-apigami==0.5.6",
2829
"aiohttp-cors==0.8.0",
2930
"aiohttp-jinja2==1.6",
3031
"aioipfs~=0.7.1",

src/aleph/web/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import jinja2
88
import pkg_resources
99
from aiohttp import web
10+
from aiohttp_apispec import (
11+
setup_aiohttp_apispec,
12+
)
1013

1114
from aleph.web.controllers.routes import register_routes
1215

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

6164
init_cors(app)
6265

66+
setup_aiohttp_apispec(
67+
app=app,
68+
title="Aleph",
69+
version="v0",
70+
url="/api/docs/json",
71+
swagger_path="/api/docs",
72+
swagger_ui_static_path="/api/docs/ui",
73+
)
74+
6375
return app

0 commit comments

Comments
 (0)