v0.4.2: fix 5 багов OpenAPI — security, nullable, RunResponse.error, pageSize

This commit is contained in:
2026-08-01 19:31:06 +04:00
parent 352a33f588
commit 0539011ca4
2 changed files with 18 additions and 14 deletions
+17 -13
View File
@@ -68,9 +68,7 @@ def _build_spec():
"description": "Polygon (mock)",
},
],
"security": [
{"bearerAuth": []},
],
"security": [],
"tags": [
{"name": "services", "description": "Сервисы (каталог)"},
{"name": "instances", "description": "Инстансы (CRUD)"},
@@ -81,11 +79,11 @@ def _build_spec():
"paths": _build_paths(),
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "token",
"description": "MOCK_AUTH_TOKEN (по умолчанию: test-token-123)",
"mockAuth": {
"type": "apiKey",
"in": "header",
"name": "X-Mock-Auth",
"description": "Токен для _mock/* эндпоинтов (по умолчанию: test-token-123)",
},
},
"schemas": {
@@ -235,9 +233,9 @@ def _build_spec():
"operation": {"type": "string"},
"kind": {"type": "string", "description": "instance | access"},
"action": {"type": "string", "description": "create | modify | delete | …"},
"dtStart": {"type": "string", "format": "date-time"},
"dtFinish": {"type": "string", "format": "date-time", "nullable": True},
"isSuccessful": {"type": "boolean"},
"dtStart": {"type": ["string", "null"], "format": "date-time"},
"dtFinish": {"type": ["string", "null"], "format": "date-time"},
"isSuccessful": {"type": ["boolean", "null"]},
"errorLog": {"type": "string"},
"svc": {"type": "string"},
"stages": {"type": "array", "items": {"$ref": "#/components/schemas/Stage"}},
@@ -288,6 +286,7 @@ def _build_spec():
"type": "object",
"properties": {
"ok": {"type": "boolean"},
"error": {"type": "string", "description": "Сообщение об ошибке (только при ok=false)"},
},
},
"MockState": {
@@ -389,8 +388,8 @@ def _build_paths():
{
"name": "pageSize",
"in": "query",
"schema": {"type": "integer", "default": 200, "maximum": 200},
"description": "Размер страницы (макс. 200)",
"schema": {"type": "integer", "default": 200},
"description": "Размер страницы (значения > 200 обрезаются до 200)",
},
{
"name": "page",
@@ -703,6 +702,7 @@ def _build_paths():
"summary": "Сброс состояния",
"description": "Удаляет **все** инстансы, операции и параметры. Используется в тестах для изоляции.",
"operationId": "mockReset",
"security": [{"mockAuth": []}],
"responses": {
"200": {
"description": "Состояние сброшено",
@@ -717,6 +717,7 @@ def _build_paths():
"summary": "Дамп состояния",
"description": "Возвращает все инстансы и операции для отладки.",
"operationId": "mockState",
"security": [{"mockAuth": []}],
"responses": {
"200": {
"description": "Текущее состояние",
@@ -731,6 +732,7 @@ def _build_paths():
"summary": "Список загруженных сервисов",
"description": "Возвращает все загруженные сервисы с количеством операций и параметров.",
"operationId": "mockServices",
"security": [{"mockAuth": []}],
"responses": {
"200": {
"description": "Список сервисов",
@@ -748,6 +750,7 @@ def _build_paths():
"Минимум: 0, максимум: 5 (защита /health)."
),
"operationId": "mockSetDelay",
"security": [{"mockAuth": []}],
"parameters": [
{
"name": "seconds",
@@ -778,6 +781,7 @@ def _build_paths():
"Позволяет тестировать негативные сценарии."
),
"operationId": "mockFailNext",
"security": [{"mockAuth": []}],
"responses": {
"200": {
"description": "Флаг установлен",