Change8

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

3
Breaking Changes
5
Migration Steps
9
Affected Symbols

⚠️ Check Your Code

If you use any of these symbols, you need to read this guide:

__pydantic_on_complete__create_modelGenerateSchemaFieldInfoSecretmodel_rebuildSkipValidationMISSINGDecimal

Breaking 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

  1. 1
    Review your codebase for any model validators defined using @classmethod; if they are intended to operate on the instance, change them to standard methods.
  2. 2
    If 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.
  3. 3
    Check all field definitions (using Field() or in dataclasses) and ensure that none of the default values are deprecated methods.
  4. 4
    If 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.
  5. 5
    If 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