Skip to main content

validate

Function validate 

Source
pub fn validate(
    spec: &Value,
    data: &Value,
    options: &ValidateOptions<'_>,
) -> Result<ValidationResult, ValidateError>
Expand description

Validate data against a CRUDUI spec. The spec may carry $ref/$patch; they are expanded first via the compose pass. An unresolved composition or a rule parameter outside the validation-rule definitions returns Err(ValidateError::Load) and data with the wrong shape returns Err(ValidateError::Input); neither produces a validation result.

Two entry shapes (JS validate): (a) a full root group spec { type:'group', properties:{…} } — compose the whole spec, then read its composed properties. (b) a properties-layer composition entry { $ref, $patch } with no own properties — compose it AS a properties map directly.