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%.
@@ -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
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"])
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
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).
- 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
- GitHub issue: #10528
- Fix PR: https://github.com/pydantic/pydantic/pull/10597
- First fixed release: 1.10.19
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.51
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@MarkusSintonen, Thanks for reporting this. We're looking into this now!”
“> @Viicos can not it take the type from the Annotated type given by the user? So we wouldnt need to double define the types?…”
“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”
“> Should be probably somehow better documented or warning-deprecated the implicit Any usage with the PlainValidator”
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
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 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
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
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.
When NOT to Use This Fix
- This fix is not applicable if using validators that do not require JSON schema compatibility.
Verify Fix
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
| Version | Status |
|---|---|
| 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.