add regional converter
This commit is contained in:
178
www/uc_openapi.json
Normal file
178
www/uc_openapi.json
Normal file
@@ -0,0 +1,178 @@
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "Конвертер ЕИ (simple_frontend)",
|
||||
"description": "Обёртка над `unit_converter/pipeline.py`: приём параметров конвертации, запуск пайплайна, возврат логов. Интерфейс: статическая страница `/`.",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"servers": [{ "url": "/uc" }],
|
||||
"paths": {
|
||||
"/api/units": {
|
||||
"get": {
|
||||
"tags": ["Справочники"],
|
||||
"summary": "Подсказки по единицам измерения",
|
||||
"operationId": "api_units_api_units_get",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/UnitsResponse" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/convert": {
|
||||
"post": {
|
||||
"tags": ["Конвертация"],
|
||||
"summary": "Запуск конвертации (pipeline.py)",
|
||||
"operationId": "api_convert_api_convert_post",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ConvertRequest" }
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful Response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/ConvertResponse" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": { "description": "Не заполнены обязательные поля" },
|
||||
"500": {
|
||||
"description": "Ошибка запуска pipeline (например нет config/скрипта)"
|
||||
},
|
||||
"422": {
|
||||
"description": "Validation Error",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": { "$ref": "#/components/schemas/HTTPValidationError" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"ConvertRequest": {
|
||||
"properties": {
|
||||
"product_name": {
|
||||
"type": "string",
|
||||
"title": "Product Name",
|
||||
"description": "Наименование товара или услуги"
|
||||
},
|
||||
"source_unit": {
|
||||
"type": "string",
|
||||
"title": "Source Unit",
|
||||
"description": "Исходная единица измерения"
|
||||
},
|
||||
"target_unit": {
|
||||
"type": "string",
|
||||
"title": "Target Unit",
|
||||
"description": "Целевая единица измерения"
|
||||
},
|
||||
"supplier_name": {
|
||||
"type": "string",
|
||||
"title": "Supplier Name",
|
||||
"description": "Поставщик (необязательно)",
|
||||
"default": ""
|
||||
},
|
||||
"product_characteristics": {
|
||||
"type": "string",
|
||||
"title": "Product Characteristics",
|
||||
"description": "Текст характеристик (необязательно)",
|
||||
"default": ""
|
||||
},
|
||||
"quantity": {
|
||||
"type": "number",
|
||||
"minimum": 0.0,
|
||||
"title": "Quantity",
|
||||
"description": "Количество в исходных ЕИ",
|
||||
"default": 1.0
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": ["product_name", "source_unit", "target_unit"],
|
||||
"title": "ConvertRequest"
|
||||
},
|
||||
"ConvertResponse": {
|
||||
"properties": {
|
||||
"process_ok": {
|
||||
"type": "boolean",
|
||||
"title": "Process Ok",
|
||||
"description": "Процесс pipeline завершился с кодом 0"
|
||||
},
|
||||
"conversion_success": {
|
||||
"type": "boolean",
|
||||
"title": "Conversion Success",
|
||||
"description": "True, если в выводе нет «перевод невозможен»"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"title": "Message",
|
||||
"description": "Краткий итог для UI"
|
||||
},
|
||||
"pipeline_output": {
|
||||
"type": "string",
|
||||
"title": "Pipeline Output",
|
||||
"description": "Полный stdout+stderr pipeline.py (логи)",
|
||||
"default": ""
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": ["process_ok", "conversion_success", "message"],
|
||||
"title": "ConvertResponse"
|
||||
},
|
||||
"HTTPValidationError": {
|
||||
"properties": {
|
||||
"detail": {
|
||||
"items": { "$ref": "#/components/schemas/ValidationError" },
|
||||
"type": "array",
|
||||
"title": "Detail"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"title": "HTTPValidationError"
|
||||
},
|
||||
"UnitsResponse": {
|
||||
"properties": {
|
||||
"units": {
|
||||
"items": { "type": "string" },
|
||||
"type": "array",
|
||||
"title": "Units",
|
||||
"description": "Список наименований ЕИ из exist_units.csv"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": ["units"],
|
||||
"title": "UnitsResponse"
|
||||
},
|
||||
"ValidationError": {
|
||||
"properties": {
|
||||
"loc": {
|
||||
"items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] },
|
||||
"type": "array",
|
||||
"title": "Location"
|
||||
},
|
||||
"msg": { "type": "string", "title": "Message" },
|
||||
"type": { "type": "string", "title": "Error Type" },
|
||||
"input": { "title": "Input" },
|
||||
"ctx": { "type": "object", "title": "Context" }
|
||||
},
|
||||
"type": "object",
|
||||
"required": ["loc", "msg", "type"],
|
||||
"title": "ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user