Jump to solution
Verify

The Fix

pip install pydantic==2.11.0

Based on closed pydantic/pydantic issue #11470 · PR/commit linked

Jump to Verify Open PR/Commit
@@ -250,7 +250,6 @@ By leveraging the new [`type` statement](https://typing.readthedocs.io/en/latest from annotated_types import Gt - from typing_extensions import TypeAliasType from pydantic import BaseModel
repro.py
pydantic version: 2.10.6 pydantic-core version: 2.27.2 pydantic-core build: profile=release pgo=false install path: /path/to/venv/lib/python3.13/site-packages/pydantic python version: 3.13.1 (main, Dec 3 2024, 17:59:52) [Clang 19.1.5 ] platform: macOS-15.3.1-arm64-arm-64bit-Mach-O related packages: mypy-1.15.0 fastapi-0.115.8 pydantic-settings-2.7.1 typing_extensions-4.12.2 commit: unknown
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install pydantic==2.11.0\nWhen NOT to use: This fix should not be applied if backward compatibility with previous Pydantic versions is required.\n\n

Why This Fix Works in Production

  • Trigger: Schema generation loses Field annotations when using PEP 695 type alias syntax
  • Mechanism: Pydantic fails to include Field annotations in JSON schemas when using PEP 695 type alias syntax
  • Why the fix works: Fixes the JSON Schema generation issue where Field annotations were lost when using PEP 695 type alias syntax. (first fixed release: 2.11.0).
Production impact:
  • If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).

Why This Breaks in Prod

  • Shows up under Python 3.13 in real deployments (not just unit tests).
  • Pydantic fails to include Field annotations in JSON schemas when using PEP 695 type alias syntax
  • Production symptom (often without a traceback): Schema generation loses Field annotations when using PEP 695 type alias syntax

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“This just so happens to have been discussed not long ago here.”
@Viicos · 2025-02-20 · source

Failure Signature (Search String)

  • Schema generation loses Field annotations when using PEP 695 type alias syntax
  • When declaring a type with a PEP 695 type alias, Pydantic does not include details provided via a `Field` annotation (like `examples`, `description`, `alias`, etc.) in generated
Copy-friendly signature
signature.txt
Failure Signature ----------------- Schema generation loses Field annotations when using PEP 695 type alias syntax When declaring a type with a PEP 695 type alias, Pydantic does not include details provided via a `Field` annotation (like `examples`, `description`, `alias`, etc.) in generated JSON schemas.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Schema generation loses Field annotations when using PEP 695 type alias syntax When declaring a type with a PEP 695 type alias, Pydantic does not include details provided via a `Field` annotation (like `examples`, `description`, `alias`, etc.) in generated JSON schemas.

Minimal Reproduction

repro.py
pydantic version: 2.10.6 pydantic-core version: 2.27.2 pydantic-core build: profile=release pgo=false install path: /path/to/venv/lib/python3.13/site-packages/pydantic python version: 3.13.1 (main, Dec 3 2024, 17:59:52) [Clang 19.1.5 ] platform: macOS-15.3.1-arm64-arm-64bit-Mach-O related packages: mypy-1.15.0 fastapi-0.115.8 pydantic-settings-2.7.1 typing_extensions-4.12.2 commit: unknown

Environment

  • Python: 3.13
  • Pydantic: 2

What Broke

Generated JSON schemas lack expected metadata, leading to incomplete API documentation.

Why It Broke

Pydantic fails to include Field annotations in JSON schemas when using PEP 695 type alias syntax

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install pydantic==2.11.0

When NOT to use: This fix should not be applied if backward compatibility with previous Pydantic versions is required.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/pydantic/pydantic/pull/11475

First fixed release: 2.11.0

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be applied if backward compatibility with previous Pydantic versions is required.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.

Version Compatibility Table

VersionStatus
2.11.0 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.