♻️(back) use same base route path for swagger
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.
This commit is contained in:
@@ -33,7 +33,7 @@ def test_openapi_client_schema():
|
|||||||
)
|
)
|
||||||
assert output.getvalue() == ""
|
assert output.getvalue() == ""
|
||||||
|
|
||||||
response = Client().get("/v1.0/swagger.json")
|
response = Client().get("/api/v1.0/swagger.json")
|
||||||
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
with open(
|
with open(
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ if settings.DEBUG:
|
|||||||
if settings.USE_SWAGGER or settings.DEBUG:
|
if settings.USE_SWAGGER or settings.DEBUG:
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
path(
|
path(
|
||||||
f"{settings.API_VERSION}/swagger.json",
|
f"api/{settings.API_VERSION}/swagger.json",
|
||||||
SpectacularJSONAPIView.as_view(
|
SpectacularJSONAPIView.as_view(
|
||||||
api_version=settings.API_VERSION,
|
api_version=settings.API_VERSION,
|
||||||
urlconf="core.urls",
|
urlconf="core.urls",
|
||||||
@@ -36,12 +36,12 @@ if settings.USE_SWAGGER or settings.DEBUG:
|
|||||||
name="client-api-schema",
|
name="client-api-schema",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
f"{settings.API_VERSION}//swagger/",
|
f"api/{settings.API_VERSION}/swagger/",
|
||||||
SpectacularSwaggerView.as_view(url_name="client-api-schema"),
|
SpectacularSwaggerView.as_view(url_name="client-api-schema"),
|
||||||
name="swagger-ui-schema",
|
name="swagger-ui-schema",
|
||||||
),
|
),
|
||||||
re_path(
|
re_path(
|
||||||
f"{settings.API_VERSION}//redoc/",
|
f"api/{settings.API_VERSION}/redoc/",
|
||||||
SpectacularRedocView.as_view(url_name="client-api-schema"),
|
SpectacularRedocView.as_view(url_name="client-api-schema"),
|
||||||
name="redoc-schema",
|
name="redoc-schema",
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user