diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a893811..fdb8ea10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to - 🩹(frontend) improve reaction toolbar centering with dynamic positioning - 🚀 (paas) remove buildpack requirements.txt to use the new uv.lock #1349 - ✨(backend) allow room configuration and access level via external api #1260 +- ♻️(backend) prefix Swagger routes with /api ### Fixed - 🩹(backend) fix swagger and redoc documentation URLs diff --git a/src/backend/core/tests/swagger/test_openapi_schema.py b/src/backend/core/tests/swagger/test_openapi_schema.py index bca28ccc..e4dfe464 100644 --- a/src/backend/core/tests/swagger/test_openapi_schema.py +++ b/src/backend/core/tests/swagger/test_openapi_schema.py @@ -34,7 +34,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( @@ -52,8 +52,8 @@ 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/") + swagger_response = client.get("/api/v1.0/swagger/") + redoc_response = client.get("/api/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 5f8b71a4..aa1e2e39 100644 --- a/src/backend/meet/urls.py +++ b/src/backend/meet/urls.py @@ -29,7 +29,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", @@ -37,12 +37,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", ), path( - f"{settings.API_VERSION}/redoc/", + f"api/{settings.API_VERSION}/redoc/", SpectacularRedocView.as_view(url_name="client-api-schema"), name="redoc-schema", ),