You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: prefixItems schemas are ignored during array repair #239
0.64.1, current main f66bdff; Python 3.12.3 / Pydantic 2.14.1 / jsonschema 4.26.0 / Windows.
Describe the bug
Schema-guided repair does not apply positional schemas from prefixItems, which Pydantic v2 generates for fixed-length typed tuples. The final validator recognizes those schemas, so a quoted integer that existing integer coercion could repair instead raises a validation error. This affects both valid JSON and malformed JSON processed through the public API.
The shared array schema configuration currently reads only legacy tuple-style items and additionalItems. I reproduced this locally while checking the documented Pydantic integration; I am not claiming production usage. The related schema PRs #171 and #178 do not include prefixItems handling.
The generated point schema includes prefixItems: [{"type": "integer"}, {"type": "integer"}].
Actual: ValueError: '1' is not of type 'integer'.
The complete JSON input '{"point": ["1", "2"]}' also fails.
Expected behavior
Return {"point": [1, 2]}, applying the existing integer coercion to each tuple position. The repaired result should pass Coordinates.model_validate.
I intend to update the shared array schema configuration to use prefixItems for positional schemas and modern items for the tail, while preserving legacy items/additionalItems behavior. Regression tests will cover the Pydantic example, valid and malformed input, and constrained or forbidden tail items. Codex assisted with investigation and reproduction and will assist with the patch and tests.
Activity
mangiucugna commentedon Oct 23, 2026
Hi, thanks for reporting. The fix is in 0.64.2