docs: document API number validation
This commit is contained in:
1 parent
a66d659400
commit
e4fa5c7ab9
1 file changed
+1
@@ -221,6 +221,7 @@ def calculate_payload(payload: dict[str, Any]) -> dict[str, Any]:
|
|||||||
return {"mode": mode, "result": asdict(result), "message": render_inspection(report, result)}
|
return {"mode": mode, "result": asdict(result), "message": render_inspection(report, result)}
|
||||||
if mode == "goal":
|
if mode == "goal":
|
||||||
def _number_value(key: str) -> float:
|
def _number_value(key: str) -> float:
|
||||||
|
"""Читает числовое поле запроса и отклоняет NaN/значения ниже нуля."""
|
||||||
value = _required(payload, key)
|
value = _required(payload, key)
|
||||||
if isinstance(value, bool):
|
if isinstance(value, bool):
|
||||||
raise ApiError(f"Поле {key} должно быть числом")
|
raise ApiError(f"Поле {key} должно быть числом")
|
||||||
|
|||||||
Reference in new issue
Block a user