Skip to main content

validate_ticker_statistic_strict

Function validate_ticker_statistic_strict 

Source
pub fn validate_ticker_statistic_strict(
    user_value: &Value,
) -> Result<(), Vec<String>>
Expand description

Same as validate_for_path but tolerates a list of dot-separated paths (e.g. ["c2s.owner"]) — these will not be flagged as unknown even if they appear in normalized post-adapter-expansion but are absent from the typed Req shape.

Use case (codex F3 fix 2026-04-27): /api/ticker-statistic route uses codex 14th-round Finding 5 (P3, 2026-04-28 02:09): testable extracted branch for /api/ticker-statistic strict validation. Let unit test 调 真 branch 而不是手写 if/else (pitfall #54 schema-only fix).

行为: 检查 user-supplied body 是否显式含 owner (4 path): (a) flat snake_case {"owner": ...} (b) flat PascalCase {"Owner": ...} (post-normalize 同 (a)) (c) nested snake_case {"c2s": {"owner": ...}} (d) nested PascalCase {"c2s": {"Owner": ...}} (post-normalize 同 (c))

任一命中 → loud reject c2s.owner / owner. 否 → 走 generic validator 容忍 adapter expand 后注入的 c2s.owner.