Skip to main content

validate_against_schema

Function validate_against_schema 

Source
pub fn validate_against_schema<T: DeserializeOwned>(
    name: SchemaName,
    data: &Value,
    source: &str,
) -> Result<T, ValidationError>
Expand description

Validate data against the named schema. Returns it deserialized into T on success; on mismatch, returns a source-prefixed ValidationError listing every failure.

Deserializing into T makes the typed result honest: the schema gate and the Rust type agree, or the call fails.