diff --git a/CHANGELOG.md b/CHANGELOG.md index eb4adcf8..0a893811 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ and this project adheres to - 🚀 (paas) remove buildpack requirements.txt to use the new uv.lock #1349 - ✨(backend) allow room configuration and access level via external api #1260 +### Fixed +- 🩹(backend) fix swagger and redoc documentation URLs + ## [1.16.0] - 2026-05-13 ### Added diff --git a/src/backend/core/tests/swagger/test_openapi_schema.py b/src/backend/core/tests/swagger/test_openapi_schema.py index 9e0919a8..bca28ccc 100644 --- a/src/backend/core/tests/swagger/test_openapi_schema.py +++ b/src/backend/core/tests/swagger/test_openapi_schema.py @@ -4,6 +4,7 @@ Test suite for generated openapi schema. import json from io import StringIO +from unittest.mock import patch from django.core.management import call_command from django.test import Client @@ -40,3 +41,19 @@ def test_openapi_client_schema(): "core/tests/swagger/swagger.json", "r", encoding="utf-8" ) as expected_schema: assert response.json() == json.load(expected_schema) + + +@patch( + "django.contrib.staticfiles.storage.staticfiles_storage.url", + side_effect=lambda name: f"/static/{name}", +) +# pylint: disable=unused-argument +def test_openapi_documentation_routes(mock_staticfiles): + """Swagger and ReDoc documentation should be served on canonical URLs.""" + client = Client() + + swagger_response = client.get("/v1.0/swagger/") + redoc_response = client.get("/v1.0/redoc/") + + assert swagger_response.status_code == 200 + assert redoc_response.status_code == 200 diff --git a/src/backend/meet/urls.py b/src/backend/meet/urls.py index 2a310f81..3fb00dde 100644 --- a/src/backend/meet/urls.py +++ b/src/backend/meet/urls.py @@ -37,12 +37,12 @@ if settings.USE_SWAGGER or settings.DEBUG: name="client-api-schema", ), path( - f"{settings.API_VERSION}//swagger/", + f"{settings.API_VERSION}/swagger/", SpectacularSwaggerView.as_view(url_name="client-api-schema"), name="swagger-ui-schema", ), re_path( - f"{settings.API_VERSION}//redoc/", + f"{settings.API_VERSION}/redoc/", SpectacularRedocView.as_view(url_name="client-api-schema"), name="redoc-schema", ),