$ the-wire · showcase
Pydantic hardens JSON mode serialization error handling
By RepoJournal · Filed · About FastAPI & Pydantic
Pydantic's JSON mode serialization now catches any exception when computing JSON Schema defaults, reducing spurious errors that leaked through.
Pydantic merged a change that makes `dump_python()` with `mode='json'` more robust [1]. Previously, several exceptions raised while computing JSON Schema defaults were propagated as-is instead of being wrapped in a `PydanticSerializationError`; now the code handles any exception raised when computing a default, so callers see consistent error handling.
Maintenance continues with a CI dependency bump: `actions/checkout` moves from 7.0.0 to 7.0.1 [2]. The release note highlights a fix that skips running an unsafe PR check when the input is the default, which reduces needless failures during pull request validation.
A docstring touch-up fixes a duplicate word, changing "it it" to "it" in the fields documentation [3]. No behavior changes are involved.
Action items
- → Review your error handling for JSON serialization paths that may have relied on raw exceptions from `dump_json` and `dump_python` with `mode='json'` pydantic/pydantic [monitor]
- → Pull the latest pydantic to include the robustness fix pydantic/pydantic [plan]
References
- [1] Handle any exception when trying to compute JSON Schema default ↗ pydantic/pydantic
- [2] Bump actions/checkout from 7.0.0 to 7.0.1 ↗ pydantic/pydantic
- [3] Fix duplicate word 'it it' in fields docstring (#13756) ↗ pydantic/pydantic