Migrating to Pydantic v2.12.0a1
Version v2.12.0a1 introduces 3 breaking changes. This guide details how to update your code.
Released: 7/26/2025
⚠️ Check Your Code
If you use any of these symbols, you need to read this guide:
__pydantic_on_complete__create_modelGenerateSchemaFieldInfoSecretmodel_rebuildSkipValidationMISSINGDecimalBreaking Changes
●Issue #1
Model validators defined as class methods might no longer be implicitly converted to instance methods during validation setup.
✓Solution
If you rely on model validators being automatically converted to instance methods, ensure they are defined as regular methods (not class methods using @classmethod) or explicitly handle the conversion if necessary.
●Issue #2
The logic for providing `field_name` in validator core schemas has been removed.
✓Solution
If your custom validation logic or schema generation relied on receiving `field_name` in the core schema context for validators, you must update that logic as this context argument is no longer provided.
●Issue #3
The use of deprecated methods as default field values is now disallowed.
✓Solution
Review any fields where the default value is a method that is now considered deprecated by Pydantic and replace it with a supported default value or factory.
Migration Steps
- 1Review your codebase for any model validators defined using @classmethod; if they are intended to operate on the instance, change them to standard methods.
- 2If you are inspecting or relying on the structure of core schemas generated for validators, remove any logic that expects the `field_name` key to be present in the context.
- 3Check all field definitions (using Field() or in dataclasses) and ensure that none of the default values are deprecated methods.
- 4If you are using Pydantic with Python 3.14, note that initial support has been added, but thorough testing is recommended as this is an alpha release.
- 5If you utilize Pydantic's `create_model()`, you can now safely pass both `config` and `bases` arguments simultaneously.
Release Summary
Pydantic v2.12.0a1 introduces initial support for Python 3.14, a new model completion hook, and experimental MISSING sentinels, while refining validator behavior and JSON schema generation.
Need More Details?
View the full release notes and all changes for Pydantic v2.12.0a1.
View Full Changelog