The Wire · Showcase
PYDANTIC FIXES DISCRIMINATED UNIONS AND VALIDATOR PIPELINE BUGS
By RepoJournal · Filed · About FastAPI & Pydantic
Viicos landed back-to-back fixes for discriminated union annotation handling and constraint application in the validation pipeline, closing two separate issues that broke real validation workflows.
The core fix targets bare `None` annotations in discriminated unions [1], a feature gap that forced developers into verbose workarounds. That same PR also corrects JSON Schema generation for mapping keys and modernizes internal logic with match statements. In parallel, a second critical fix addresses constraint application in the pipeline API [2], catching a regression missed in an earlier commit that left certain field constraints silently unapplied. On the types side, Pydantic's URL equality comparisons now return `NotImplemented` for foreign types [3], fixing an asymmetry that broke comparison contracts with mock objects and custom equality implementations. Two more PRs in flight: one enforcing runtime alias validation config when wrap validators are present [4], and another teaching JSON Schema generation to respect the `ser_json_temporal` config flag [5], which prevents the schema from rejecting payloads that `model_dump_json()` itself produces.
One email a day. Unsubscribe in one click.
Keep up with FastAPI & Pydantic in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Review and merge the discriminated union fix [ref:1] and pipeline constraint fix [ref:2] before your next release pydantic/pydantic [immediate]
- → Monitor the wrap validator and JSON Schema temporal config PRs [ref:4] [ref:5] for merge readiness pydantic/pydantic [plan]
References
- [1] Support bare `None` annotation for discriminated unions ↗ pydantic/pydantic
- [2] Fix application of other constraints in the pipeline API ↗ pydantic/pydantic
- [3] Return `NotImplemented` from URL equality comparisons with foreign types ↗ pydantic/pydantic
- [4] Respect runtime alias validation configuration when wrap validators are present ↗ pydantic/pydantic
- [5] Take `ser_json_temporal` into account when generating JSON Schema ↗ pydantic/pydantic