Skip to main content

validate_against_schema

Function validate_against_schema 

Source
pub fn validate_against_schema(schema: &Value, input: &Value) -> Result<()>
Expand description

Validate input against a JSON Schema (Phase 2 - Full JSON Schema 2020-12)

§Arguments

  • schema - The JSON Schema to validate against (JSON Schema 2020-12)
  • input - The input value to validate

§Returns

  • Ok(()) if validation succeeds
  • Err with detailed error message if validation fails

§Validation Coverage (Phase 2)

  • Type validation (string, number, integer, boolean, object, array)
  • Required properties
  • Min/max constraints (minLength, maxLength, minimum, maximum)
  • Pattern matching (regex)
  • Enum validation
  • Nested objects and arrays
  • Complex schemas (oneOf, anyOf, allOf, not)