v0.5.9: Swagger — спека встроена в HTML, без отдельного HTTP-запроса

This commit is contained in:
2026-08-02 12:59:22 +04:00
parent e206b65dc6
commit 32b8f772f3
4 changed files with 17 additions and 11 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ SERVICES = _DF["SERVICES"]
OPS_INDEX = _DF["OPS_INDEX"]
DELAY = float(os.getenv("MOCK_OP_DELAY", "0.1"))
VERSION = "0.5.8"
VERSION = "0.5.9"
def get_services(stand_id):
+5 -2
View File
@@ -89,12 +89,15 @@ def index():
def swagger():
"""Swagger UI — интерактивная документация API.
Загружает Swagger UI с CDN, указывает на /api/v1/svc/openapi.json.
Спек OpenAPI встроена прямо в HTML — без отдельного HTTP-запроса.
Токен авторизации предзаполняется автоматически (MOCK_AUTH_TOKEN).
"""
from routes.openapi import _build_spec
import json as _json
spec_json = _json.dumps(_build_spec(), ensure_ascii=False)
return render_template(
"swagger.html",
version=_cfg.VERSION,
openapi_url="/api/v1/svc/openapi.json",
spec_json=spec_json,
auth_token=_MOCK_AUTH_TOKEN,
)
+1 -1
View File
@@ -78,7 +78,7 @@
<script>
window.onload = function () {
const ui = SwaggerUIBundle({
url: "{{ openapi_url }}",
spec: {{ spec_json | safe }},
dom_id: "#swagger-ui",
deepLinking: true,
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],