Skip to main content

project_dto

Function project_dto 

Source
pub fn project_dto(value: &Value, max_depth: usize) -> Result<(), Violation>
Expand description

Check an untrusted parsed value against the DTO rules.

Rust cannot express the getter, proxy or sparse-array cases the reference implementation guards against — serde_json cannot produce them — so this enforces what remains: reserved property names and the depth ceiling. Non-finite numbers cannot survive JSON parsing at all.

§Errors

Returns a Violation with code dto-key or dto-depth.