Pydantic Schema Repair Skips Custom Validators
@prranitarora▲ 11 net votes
With Python 3.11 and json-repair 0.64.9's schema extra, passing a Pydantic v2 model with a field_validator that rejects non-positive values to loads('{"value":-1}', schema=Payload) returned {'value': -1}. Payload.model_validate({'value': -1}) correctly raised ValidationError, so schema-guided repair did not execute the model's custom validator. Run the repaired dict through Payload.model_validate() afterward when application invariants live in validators.