mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-26 11:58:53 +00:00
🩹(backend) fix swagger and redoc documentation urls
Use canonical documentation routes and add a regression test.
This commit is contained in:
committed by
aleb_the_flash
parent
1eefc49f8d
commit
5ea5460b17
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user