Compile-time registry for consolidating property validators across combining schemas.
When combining filters (allOf, anyOf, oneOf) contain sub-schemas with properties, this module collects all property validators and allows generating a single-pass iteration instead of iterating once per sub-schema.
Architecture
The registry collects property definitions from multiple sub-schemas and generates a merged iterator that validates all properties in a single pass.
Combining Semantics
- allOf: All validators for a property must pass (AND semantics)
- anyOf: At least one sub-schema's validators must pass
- oneOf: Exactly one sub-schema's validators must pass
Summary
Functions
Analyzes sub-schemas in a combining filter and returns optimization info.
Builds a merged property registry from optimizable sub-schema indices.
Checks if optimization is beneficial for the given combining filter.
Generates a merged iterator that validates all properties in a single pass.
Generates a merged property validator function for allOf semantics.
Checks if a sub-schema is "property-only" and can be merged.
Functions
Analyzes sub-schemas in a combining filter and returns optimization info.
Returns a tuple: {optimizable_indices, non_optimizable_indices}
Where:
- optimizable_indices: list of sub-schema indices that can be merged
- non_optimizable_indices: list of indices that need standard processing
Builds a merged property registry from optimizable sub-schema indices.
Returns: %{
properties: %{property_name => [{sub_index, pointer, schema}]},
pattern_properties: [{pattern, sub_index, pointer, schema}]}
Checks if optimization is beneficial for the given combining filter.
Returns true if there are at least 2 optimizable sub-schemas (worth the overhead).
Generates a merged iterator that validates all properties in a single pass.
Generates a merged property validator function for allOf semantics.
This creates a function that validates a property against ALL validators from all merged sub-schemas that define that property.
Checks if a sub-schema is "property-only" and can be merged.
A schema is property-only if it only contains:
- type (must include "object" or be absent)
- properties
- patternProperties
- metadata (title, description, etc.)
Returns true if the schema can be fully handled by the merged property iterator.