Jump to solution
Verify

The Fix

pip install pydantic==1.10.19

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

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Jump to Verify Open PR/Commit
@@ -163,6 +163,11 @@ class PlainValidator: A metadata class that indicates that a validation should be applied **instead** of the inner validation logic. + !!! note: + Before v2.9, `PlainValidator` wasn't always compatible with JSON Schema generation for `mode='validation'`. + You can now use the `json_schema_input_type` argument to specify the input type of the function
repro.py
from datetime import datetime from typing import Annotated from pydantic import BaseModel, PlainValidator class Model(BaseModel): my_field: Annotated[datetime, PlainValidator(lambda v: v)] # In v2.8.2 this is correct # {'format': 'date-time', 'title': 'My Field', 'type': 'string'} # In v2.9.0 type information is lost. Also in latest v2.9.2 # {'title': 'My Field'} print(Model.model_json_schema()["properties"]["my_field"])
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==1.10.19\nWhen NOT to use: This fix is not applicable if using validators that do not require JSON schema compatibility.\n\n

Why This Fix Works in Production

  • Trigger: Annotated field schemas broken after v2.9.0
  • Mechanism: Added a note to the documentation of `PlainValidator` regarding JSON schemas, addressing the oversight that caused issues with annotated field schemas after v2.9.0.
  • Why the fix works: Added a note to the documentation of `PlainValidator` regarding JSON schemas, addressing the oversight that caused issues with annotated field schemas after v2.9.0. (first fixed release: 1.10.19).
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Production symptom (often without a traceback): Annotated field schemas broken after v2.9.0

Proof / Evidence

Discussion

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

“@MarkusSintonen, Thanks for reporting this. We're looking into this now!”
@sydney-runkle · 2024-10-01 · source
“> @Viicos can not it take the type from the Annotated type given by the user? So we wouldnt need to double define the types?…”
@Viicos · 2024-10-07 · source
“Should be probably somehow better documented or warning-deprecated the implicit Any usage with the PlainValidator. I don't think that implicit behavior makes much sense”
@MarkusSintonen · 2024-10-03 · source
“> Should be probably somehow better documented or warning-deprecated the implicit Any usage with the PlainValidator”
@sydney-runkle · 2024-10-07 · source

Failure Signature (Search String)

  • Annotated field schemas broken after v2.9.0
  • Following example shows how `Annotated` fields lost their schema `type` and `format` after v2.9.0
Copy-friendly signature
signature.txt
Failure Signature ----------------- Annotated field schemas broken after v2.9.0 Following example shows how `Annotated` fields lost their schema `type` and `format` after v2.9.0

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Annotated field schemas broken after v2.9.0 Following example shows how `Annotated` fields lost their schema `type` and `format` after v2.9.0

Minimal Reproduction

repro.py
from datetime import datetime from typing import Annotated from pydantic import BaseModel, PlainValidator class Model(BaseModel): my_field: Annotated[datetime, PlainValidator(lambda v: v)] # In v2.8.2 this is correct # {'format': 'date-time', 'title': 'My Field', 'type': 'string'} # In v2.9.0 type information is lost. Also in latest v2.9.2 # {'title': 'My Field'} print(Model.model_json_schema()["properties"]["my_field"])

Environment

  • Pydantic: 2

What Broke

Annotated fields lost their schema type and format, causing incorrect JSON output.

Fix Options (Details)

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

pip install pydantic==1.10.19

When NOT to use: This fix is not applicable if using validators that do not require JSON schema compatibility.

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/10597

First fixed release: 1.10.19

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 is not applicable if using validators that do not require JSON schema compatibility.

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
1.10.19 Fixed

Related Issues

No related fixes found.

Sources

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