Compare commits

...
Sign in to create a new pull request.

5 commits

2 changed files with 3 additions and 3 deletions

View file

@ -54,7 +54,7 @@ def merge_upstream_schemas(result, generator, request, public):
"""drf-spectacular POSTPROCESSING_HOOKS entry point. """drf-spectacular POSTPROCESSING_HOOKS entry point.
Folds every proxied service's own OpenAPI document into this service's Folds every proxied service's own OpenAPI document into this service's
schema under `/<service>/...` paths (mirroring apps.proxy.views), so the schema under `/api/<service>/...` paths (mirroring apps.proxy.views), so the
combined swagger covers every endpoint this proxy forwards to, DTOs combined swagger covers every endpoint this proxy forwards to, DTOs
included. Schemas are cached per service; a service that's unconfigured included. Schemas are cached per service; a service that's unconfigured
or unreachable is skipped rather than failing the whole document. or unreachable is skipped rather than failing the whole document.
@ -109,6 +109,6 @@ def merge_upstream_schemas(result, generator, request, public):
operation["tags"] = [label] operation["tags"] = [label]
if "operationId" in operation: if "operationId" in operation:
operation["operationId"] = f"{service}_{operation['operationId']}" operation["operationId"] = f"{service}_{operation['operationId']}"
result["paths"][f"/{service}{path}"] = proxied_operations result["paths"][f"/api/{service}{path}"] = proxied_operations
return result return result

View file

@ -16,5 +16,5 @@ urlpatterns = [
path("api/reports/", include("apps.reports.urls")), path("api/reports/", include("apps.reports.urls")),
# Catch-all reverse proxy: thisprojectbaseurl/<service>/<rest of url>. # Catch-all reverse proxy: thisprojectbaseurl/<service>/<rest of url>.
# Must stay last so it never shadows the routes above. # Must stay last so it never shadows the routes above.
path("", include("apps.proxy.urls")), path("api/", include("apps.proxy.urls")),
] ]