From e206b65dc613fc2fe05d8aee25f00362fa47cfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Sun, 2 Aug 2026 12:32:56 +0400 Subject: [PATCH] =?UTF-8?q?v0.5.8:=20openapi.json=20=E2=80=94=20=D0=B3?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B2=D0=B0=D1=8F=20JSON-=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=BA=D0=B0=20=D0=B2=20=D0=BF=D0=B0=D0=BC=D1=8F=D1=82?= =?UTF-8?q?=D0=B8,=20=D0=B1=D0=B5=D0=B7=20jsonify=20=D0=BD=D0=B0=20=D0=BA?= =?UTF-8?q?=D0=B0=D0=B6=D0=B4=D1=8B=D0=B9=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/config/loader.py | 2 +- site/routes/openapi.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/site/config/loader.py b/site/config/loader.py index 6d8d52d..7fdb755 100644 --- a/site/config/loader.py +++ b/site/config/loader.py @@ -80,7 +80,7 @@ SERVICES = _DF["SERVICES"] OPS_INDEX = _DF["OPS_INDEX"] DELAY = float(os.getenv("MOCK_OP_DELAY", "0.1")) -VERSION = "0.5.7" +VERSION = "0.5.8" def get_services(stand_id): diff --git a/site/routes/openapi.py b/site/routes/openapi.py index 309916d..a2a90c0 100644 --- a/site/routes/openapi.py +++ b/site/routes/openapi.py @@ -10,7 +10,9 @@ Swagger UI загружает этот JSON через /swagger и рендер import os -from flask import Blueprint, jsonify +import json + +from flask import Blueprint, jsonify, Response import config.loader as _cfg @@ -36,11 +38,11 @@ def _build_servers(): @bp.route("/openapi.json", methods=["GET"]) def openapi_spec(): - """GET /api/v1/svc/openapi.json — OpenAPI 3.1.0 спецификация (кешируется).""" + """GET /api/v1/svc/openapi.json — OpenAPI 3.1.0 спецификация (кеш в памяти).""" global _SPEC_CACHE if _SPEC_CACHE is None: - _SPEC_CACHE = _build_spec() - return jsonify(_SPEC_CACHE) + _SPEC_CACHE = json.dumps(_build_spec(), ensure_ascii=False) + return Response(_SPEC_CACHE, mimetype="application/json") def _build_spec():