From b84015e44066bd6f4fc9a1541b05ca856bb1ee45 Mon Sep 17 00:00:00 2001 From: Liviu Anita Date: Tue, 3 Sep 2024 16:50:58 +0100 Subject: [PATCH 1/2] Remove version from path --- api/helm-chart/templates/tests/test-connection.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/helm-chart/templates/tests/test-connection.yaml b/api/helm-chart/templates/tests/test-connection.yaml index a056d526..c2cb877c 100644 --- a/api/helm-chart/templates/tests/test-connection.yaml +++ b/api/helm-chart/templates/tests/test-connection.yaml @@ -14,5 +14,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "api.fullname" . }}:{{ .Values.service.port }}/v2/openapi.json', '--quiet'] + args: ['{{ include "api.fullname" . }}:{{ .Values.service.port }}/openapi.json', '--quiet'] restartPolicy: Never From e297625d4aa6873634c5601f7227a435e1c7a1b6 Mon Sep 17 00:00:00 2001 From: Liviu Anita Date: Wed, 4 Sep 2024 09:35:35 +0100 Subject: [PATCH 2/2] Leave redoc/openapi.json versioned --- api/api/app.py | 12 ++++++++++++ api/helm-chart/templates/tests/test-connection.yaml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/api/api/app.py b/api/api/app.py index 7c6b40c3..d9fd75a5 100644 --- a/api/api/app.py +++ b/api/api/app.py @@ -5,6 +5,8 @@ from api.models.repository import repository_create, Repository from fastapi import FastAPI +from fastapi.openapi.docs import get_redoc_html + from typing import AsyncGenerator from api.api_logging import log_info @@ -31,6 +33,16 @@ async def repository_dependency() -> AsyncGenerator[Repository, None]: app.include_router(auth.router, prefix="/v2") +@app.get("/v2/openapi.json", include_in_schema=False) +async def get_custom_openapi(): + return app.openapi() + + +@app.get("/v2/redoc", include_in_schema=False) +async def custom_redoc(): + return get_redoc_html(openapi_url="/v2/openapi.json", title="BioImage Archive API") + + @app.on_event("startup") def on_start(): log_info("App started") diff --git a/api/helm-chart/templates/tests/test-connection.yaml b/api/helm-chart/templates/tests/test-connection.yaml index c2cb877c..a056d526 100644 --- a/api/helm-chart/templates/tests/test-connection.yaml +++ b/api/helm-chart/templates/tests/test-connection.yaml @@ -14,5 +14,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "api.fullname" . }}:{{ .Values.service.port }}/openapi.json', '--quiet'] + args: ['{{ include "api.fullname" . }}:{{ .Values.service.port }}/v2/openapi.json', '--quiet'] restartPolicy: Never