How It Works
It validates that:- Structure: The output matches the required JSON keys and types.
- Logic: The numeric values inside the JSON are mathematically consistent (e.g.,
total == sum(items)).
Usage
Array validation
The Schema Verifier supports standard JSON Schema array keywords includinguniqueItems.
uniqueItems — fail-closed validation
When a schema sets uniqueItems: true, the verifier checks that every element in the array is distinct. If an element is unhashable or otherwise cannot be compared deterministically (for example, an object containing a Python set), the verifier fails closed — it reports a uniqueness_validation_error issue instead of silently passing.
This ensures that unverifiable arrays are never treated as valid.
Issue types returned for uniqueItems:
| Issue type | Meaning |
|---|---|
uniqueness_violation | Duplicate items were found in the array |
uniqueness_validation_error | Uniqueness could not be verified deterministically (fail-closed) |
This fail-closed behavior shipped in v5.1.0. See the changelog for the full release notes.
When to use
- Invoice Processing: Ensure line items sum to the total.
- Financial Reports: Ensure balance sheets balance.
- Tax Forms: Ensure calculated fields match underlying data.