$ the-wire · showcase
Pydantic aligned enum constructors with both validation modes
By RepoJournal · Filed · About FastAPI & Pydantic · Composed from the cited sources · methodology
Pydantic now calls enum constructors in both validation modes, closing a behavioral gap that dated back to two pydantic-core changes.
Pydantic has changed how enum validation resolves values, so the enum class is now called in both validation modes [1]. The gap originated when pydantic-core introduced handling that never called the enum class, forcing `_missing_()` to be passed manually in the core schema [1]. A later pydantic-core change shifted that behavior again, and this fix reconciles it [1].
For code relying on custom enum `_missing_()` logic, this means the manual plumbing is no longer required in the core schema [1]. The change lands through the commit call enum constructors in both validation modes [2].
No version number, release tag, or breaking-change warning accompanies this change in the available details [1][2].
Action items
- → Review enum validation paths in code that manually passed `_missing_()` into the core schema pydantic/pydantic [plan]
References
- [1] Call enum constructors in both validation modes ↗ pydantic/pydantic
- [2] Call enum constructors in both validation modes (#13792) ↗ pydantic/pydantic