"""Swagger UI for manual experiments: http://127.0.0.1:8080/docs The page shows the course contract contracts/openapi.json as is (it is not generated from our code). Only `servers` is replaced with "/" so that the "Try it out" requests go to the same host the page was opened from. Swagger UI itself (JS/CSS) is loaded by the browser from the jsDelivr CDN. Disable with DOCS_ENABLED=false. """ from __future__ import annotations import json from functools import lru_cache from pathlib import Path from starlette.requests import Request from starlette.responses import HTMLResponse, JSONResponse SPEC_PATH = Path(__file__).resolve().parents[2] / "contracts" / "openapi.json" SWAGGER_UI = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.33.0" PAGE = f"""