From eb23aefd55ecb3eb1b6acfbac5d10ecfe5e4bb84 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Fri, 14 Mar 2025 14:22:57 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(back)=20use=20same=20base=20?= =?UTF-8?q?route=20path=20for=20swagger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Swaggers urls where not using the same base route path /api/v1.0, we prepend it to have the same path everywhere. Moreover, a double slash was used for swagger and redoc dashboard. --- src/backend/core/tests/swagger/test_openapi_schema.py | 2 +- src/backend/impress/urls.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/core/tests/swagger/test_openapi_schema.py b/src/backend/core/tests/swagger/test_openapi_schema.py index 9e0919a8..74b0f183 100644 --- a/src/backend/core/tests/swagger/test_openapi_schema.py +++ b/src/backend/core/tests/swagger/test_openapi_schema.py @@ -33,7 +33,7 @@ def test_openapi_client_schema(): ) assert output.getvalue() == "" - response = Client().get("/v1.0/swagger.json") + response = Client().get("/api/v1.0/swagger.json") assert response.status_code == 200 with open( diff --git a/src/backend/impress/urls.py b/src/backend/impress/urls.py index 5dc490ac..2c5964d4 100644 --- a/src/backend/impress/urls.py +++ b/src/backend/impress/urls.py @@ -28,7 +28,7 @@ if settings.DEBUG: if settings.USE_SWAGGER or settings.DEBUG: urlpatterns += [ path( - f"{settings.API_VERSION}/swagger.json", + f"api/{settings.API_VERSION}/swagger.json", SpectacularJSONAPIView.as_view( api_version=settings.API_VERSION, urlconf="core.urls", @@ -36,12 +36,12 @@ if settings.USE_SWAGGER or settings.DEBUG: name="client-api-schema", ), path( - f"{settings.API_VERSION}//swagger/", + f"api/{settings.API_VERSION}/swagger/", SpectacularSwaggerView.as_view(url_name="client-api-schema"), name="swagger-ui-schema", ), re_path( - f"{settings.API_VERSION}//redoc/", + f"api/{settings.API_VERSION}/redoc/", SpectacularRedocView.as_view(url_name="client-api-schema"), name="redoc-schema", ),