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
Object validation
The Schema Verifier supports standard JSON Schema object keywords includingproperties, required, and additionalProperties.
additionalProperties: false — strict fail-closed validation
When a schema sets "additionalProperties": false and the verifier runs with strict=True (the default), any property that is not declared in properties causes the payload to fail validation. The verifier records each undeclared property as an ERROR-severity additional_property issue, so is_valid is false and status is INVALID.
In non-strict mode (strict=False), additionalProperties: false is treated as advisory and undeclared properties do not block validation.
Issue types returned for additionalProperties:
| Issue type | Severity | Meaning |
|---|---|---|
additional_property | ERROR (strict) | An undeclared property was present and additionalProperties is false |
This fail-closed behavior for strict
additionalProperties: false was hardened in the v5.1.x line. See the changelog for the release notes.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.
Object validation
Strict mode and additionalProperties: false
When a schema sets additionalProperties: false and you call the verifier with strict=True, undeclared properties on the payload now cause verification to fail closed. The verifier emits an additional_property issue with severity ERROR, and the overall result is INVALID.
Previously, undeclared properties in strict mode were recorded with severity WARNING. Because validity was determined only by ERROR-level issues, payloads with forbidden extra fields could still return VALID. A strict schema denial is a structural validation failure, not an advisory warning, so strict mode now rejects these payloads outright.
This applies at every level of the schema — extra properties on nested objects that set additionalProperties: false are also rejected.
Behavior matrix:
| Mode | additionalProperties | Extra field present | Result |
|---|---|---|---|
strict=True | false | yes | is_valid: false, status: "INVALID", severity: "ERROR" |
strict=True | false | no | is_valid: true, status: "VALID" |
strict=False | false | yes | is_valid: true, status: "VALID" (permissive) |
This fail-closed behavior is enabled only when
strict=True. With strict=False, extra properties remain non-blocking and the payload is still treated as valid, preserving permissive workflows.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.
- Strict API contracts: Reject payloads with undeclared fields when
strict=TrueandadditionalProperties: falseare combined.