JSONSchex.Validator.Reference (jsonschex v0.11.2)

Copy Markdown View Source

Resolves $ref and $dynamicRef during validation, including remote schema loading and JIT compilation of JSON Pointer references. Prepares resource-local validation contexts for structural descent and resolved reference targets.

Summary

Functions

Resolves a $dynamicRef by checking if the static target has a matching $dynamicAnchor, then performing dynamic scope lookup through the scope stack. Falls back to static $ref resolution if no dynamic anchor is found.

Resolves and validates a static $ref.

Validates a compiled $ref using its pre-resolved lookup key.

Functions

validate_dynamic_ref(data, ref_string, context)

Resolves a $dynamicRef by checking if the static target has a matching $dynamicAnchor, then performing dynamic scope lookup through the scope stack. Falls back to static $ref resolution if no dynamic anchor is found.

validate_ref(data, ref_string, arg)

Resolves and validates a static $ref.

Looks up the target schema in the compiled defs registry. If not found locally and the reference points to a remote URI, attempts to load it using the loader. Supports JSON Pointer references, anchor references, and absolute/relative URIs.

validate_ref(data, ref_string, resolved_uri, context)

Validates a compiled $ref using its pre-resolved lookup key.

ref_string is the original reference; resolved_uri is the binary key computed during compilation and is looked up without resolving it again. Fragment-only keys distinguish resource-local pointer aliases from registered anchors; other keys are looked up directly in the shared defs registry. Cache hits prepare the target's resource context before validation.

On a cache miss, falls back to validate_ref/3 with the original reference, allowing built-in schema loading, remote loading, and JIT JSON Pointer resolution.