v2.14.0b2 2026-09-09
- Allow any CoreSchema to be used as serialization
- Add support for frozendict type
- Allow dict, frozendict and frozenset as defaultdict default factories
- Add support for TypeForm for static type checking where a type form is expected, such as type adapters
- Add support for lazy imports
- Stabilize MISSING sentinel type, which is no longer experimental and can be imported as from pydantic import MISSING
- Take ser_json_temporal into account when generating JSON Schema
- Use the field name in __signature__ when validate_by_alias is False
- Add a deque core schema
- Do not mention MISSING as a valid value in validation errors
- Refactor Decimal JSON Schema pattern constraint
- Refactor type references logic
- Improve performance of GenerateSchema.generate_schema() dispatching
- Move schema gathering logic to pydantic-core
- Improve performance of FieldInfo construction
- Fix support for callable discriminators with PEP 695 type aliases
- Preserve re.Pattern instance for compiled patterns in the experimental pipeline
- Fix missing GC traversal on some pydantic-core struct fields
- Fix missing GC traversal in pydantic-core for GeneralFieldsSerializer
- Fix JSON schema discriminator mapping keys for bool discriminators
- Fix application of other constraints in the pipeline API
- Support bare None annotation for discriminated unions
- Respect runtime alias validation configuration when wrap validators are present
- Exclude computed fields with exclude_if from JSON Schema required fields
- Use config of TypeAdapter in JSON Schema generation
- Support populate_by_name in @validate_call
- Allow None to serialize against secret fields
- Do not drop include/exclude if serializer wasn't called
From Pydantic
What's Changed
This pre-release adds full support for Python 3.15 specific features, such as support for frozendict, making use of TypeForm and stabilizing the MISSING sentinel type.
New Features
-
Allow any
CoreSchemato be used as serialization by @Viicos in #13680 -
Add support for
frozendicttype by @Viicos in #13634 -
Allow
dict,frozendictandfrozensetasdefaultdictdefault factories by @Viicos in #13623 -
Add support for
TypeFormby @Viicos in #13459.This adds support for static type checking where a type form is expected. For instance, type adapters:
from pydantic import TypeAdapter ta = TypeAdapter(int | str) assert_type(ta.validate_python(1), int | str) -
Add support for lazy imports by @Viicos in #13776
-
Stabilize
MISSINGsentinel by @Viicos in #13782.The
MISSINGsentinel is no longer experimental, and can be imported asfrom pydantic import MISSING.
Changes
- Take
ser_json_temporalinto account when generating JSON Schema by @shashiKundur1 in #13665 - Use the field name in
__signature__whenvalidate_by_aliasisFalseby @jaideeppyne in #13730 - Add a
dequecore schema by @Viicos in #13757 - Do not mention
MISSINGas a valid value in validation errors by @Viicos in #13779 - Refactor
DecimalJSON Schemapatternconstraint by @Viicos in #13672
Performance
- Refactor type references logic by @Viicos in #13643
- Improve performance of
GenerateSchema.generate_schema()dispatching by @Viicos in #13614 - Move schema gathering logic to
pydantic-coreby @Viicos in #13725 - Improve performance of
FieldInfoconstruction by @Viicos in #13726
Fixes
- Fix support for callable discriminators with PEP 695 type aliases by @Viicos in #13604
- Preserve
re.Patterninstance for compiled patterns in the experimental pipeline by @soma0212 in #13611 - Fix missing GC traversal on some
pydantic-corestruct fields by @Viicos in #13624 - Fix missing GC traversal in
pydantic-coreforGeneralFieldsSerializerby @Viicos in #13629 - Fix JSON schema discriminator mapping keys for
booldiscriminators by @remi-fongaufier in #13632 - Fix application of other constraints in the pipeline API by @Viicos in #13659
- Support bare
Noneannotation for discriminated unions by @Viicos in #13667 - Respect runtime alias validation configuration when wrap validators are present by @Viicos in #13668
- Exclude computed fields with
exclude_iffrom JSON Schema required fields by @Bishwas-py in #13563 - Use config of
TypeAdapterin JSON Schema generation by @Viicos in #13676 - Support
populate_by_namein@validate_callby @Viicos in #13691 - Allow
Noneto serialize against secret fields by @Viicos in #13699 - Do not drop include/exclude if serializer wasn't called by @Viicos in #13702
- Don't apply serialization temporal formats to validation JSON schemas by @MLuc24 in #13711
- Reflect
str_min_lengthandstr_max_lengthconfig in the JSON schema by @MLuc24 in #13714 - Treat a class attribute set to
Noneas existing when assigning withextra='allow'by @Kropiunig in #13718 - Use the field name in validation JSON schemas when
validate_by_aliasisFalseby @MLuc24 in #13717 - Do not rely on normalization to validate decimals by @Viicos in #13742
- Handle any exception when trying to compute JSON Schema default by @Viicos in #13741
- Fix Mypy plugin crash with import cycle by @Viicos in #13767
- Fix supported constraints for types of
datetimemodule by @Viicos in #13768 - Fix inconsistencies between constraints and core schemas allowed values by @Viicos in #13772
- Allow
selfto be used as a parameter with@validate_callby @Viicos in #13773 - Fix race conditions in freethreaded build by @Viicos in #13785
New Contributors
- @soma0212 made their first contribution in #13611
- @remi-fongaufier made their first contribution in #13632
- @shashiKundur1 made their first contribution in #13665
- @MLuc24 made their first contribution in #13711
- @jaideeppyne made their first contribution in #13730
Full Changelog: https://github.com/pydantic/pydantic/compare/v2.14.0a1...v2.14.0b2