From 7398eab696aa7580833c31683610eb9992bc85ce Mon Sep 17 00:00:00 2001 From: mhh Date: Tue, 19 Mar 2024 17:33:07 +0100 Subject: [PATCH 1/3] Add aiohttp-apispec auto generation of OpenAPI docs & specs --- pyproject.toml | 1 + src/aleph/web/__init__.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index baa267d32..c71fed0d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,7 @@ dependencies = [ "aiocache==0.12.3", "aiofiles==24.1.0", "aiohttp==3.12.15", + "aiohttp-apigami==0.5.6", "aiohttp-cors==0.8.0", "aiohttp-jinja2==1.6", "aioipfs~=0.7.1", diff --git a/src/aleph/web/__init__.py b/src/aleph/web/__init__.py index 216087a6b..a96bd934c 100644 --- a/src/aleph/web/__init__.py +++ b/src/aleph/web/__init__.py @@ -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 @@ -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 From 9d12a69a839be01e407a4b7535caabaad3256375 Mon Sep 17 00:00:00 2001 From: Olivier Desenfans Date: Tue, 28 Oct 2025 00:44:55 +0100 Subject: [PATCH 2/3] lint --- src/aleph/web/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/aleph/web/__init__.py b/src/aleph/web/__init__.py index a96bd934c..2ad177ccb 100644 --- a/src/aleph/web/__init__.py +++ b/src/aleph/web/__init__.py @@ -7,9 +7,7 @@ import jinja2 import pkg_resources from aiohttp import web -from aiohttp_apispec import ( - setup_aiohttp_apispec, -) +from aiohttp_apispec import setup_aiohttp_apispec from aleph.web.controllers.routes import register_routes From ed9af31ffe4a8b6f05bc756dc548ebd3c19f4fd3 Mon Sep 17 00:00:00 2001 From: Olivier Desenfans Date: Tue, 28 Oct 2025 00:45:51 +0100 Subject: [PATCH 3/3] apispec->apigami --- src/aleph/web/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aleph/web/__init__.py b/src/aleph/web/__init__.py index 2ad177ccb..497e5fed2 100644 --- a/src/aleph/web/__init__.py +++ b/src/aleph/web/__init__.py @@ -7,7 +7,7 @@ import jinja2 import pkg_resources from aiohttp import web -from aiohttp_apispec import setup_aiohttp_apispec +from aiohttp_apigami import setup_aiohttp_apispec from aleph.web.controllers.routes import register_routes