Skip to main content

resolve_refs

Function resolve_refs 

Source
pub fn resolve_refs(
    schema: &Value,
    max_depth: usize,
    module_id: &str,
) -> Result<Value, RefResolverError>
Expand description

Inline all $ref pointers in a JSON Schema value.

Resolves $ref values by looking them up in schema["$defs"] and substituting the referenced schema in-place. Handles nested schemas recursively up to max_depth.

§Arguments

  • schema — JSON Schema value (deep-copy is used internally)
  • max_depth — maximum recursion depth before raising MaxDepthExceeded
  • module_id — module identifier for error messages

§Errors

  • RefResolverError::Unresolvable — unknown $ref target (exit 45)
  • RefResolverError::Circular — circular reference (exit 48)
  • RefResolverError::MaxDepthExceeded — depth limit reached