Jump to solution
Verify

The Fix

pip install pydantic==1.10.18

Based on closed pydantic/pydantic issue #10031 · 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
@@ -265,11 +265,6 @@ def modify_model_json_schema( json_schema = handler(schema_or_field) original_schema = handler.resolve_ref_schema(json_schema) - # Preserve the fact that definitions schemas should never have sibling keys: - if '$ref' in original_schema: - ref = original_schema['$ref']
repro.py
from pydantic import BaseModel, ConfigDict, Field class Test(BaseModel): val: str = "test" class Foo(BaseModel): bar: Test = Field(description="test") quz: Test Foo.model_json_schema()
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.18\nWhen NOT to use: This fix should not be applied if the behavior of allOf is required for specific schema validation.\n\n

Why This Fix Works in Production

  • Trigger: JSON schema uses allOf when adding Field(description="")
  • Mechanism: The JSON schema incorrectly adds an allOf wrapper when a description is provided for a Field
  • Why the fix works: Removes the unnecessary allOf JSON schema workarounds, allowing sibling keys alongside $ref keys. (first fixed release: 1.10.18).
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

  • Shows up under Python 3.11 in real deployments (not just unit tests).
  • The JSON schema incorrectly adds an allOf wrapper when a description is provided for a Field
  • Production symptom (often without a traceback): JSON schema uses allOf when adding Field(description="")

Proof / Evidence

Discussion

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

“Hi @kwint, Thanks for reporting this. I think this should be fixed by https://github.com/pydantic/pydantic/pull/10029 :)”
@sydney-runkle · 2024-08-02 · confirmation · source

Failure Signature (Search String)

  • JSON schema uses allOf when adding Field(description="")
  • When adding a description to a Field the schema adds an extra layer with an `allOf` array.
Copy-friendly signature
signature.txt
Failure Signature ----------------- JSON schema uses allOf when adding Field(description="") When adding a description to a Field the schema adds an extra layer with an `allOf` array.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- JSON schema uses allOf when adding Field(description="") When adding a description to a Field the schema adds an extra layer with an `allOf` array.

Minimal Reproduction

repro.py
from pydantic import BaseModel, ConfigDict, Field class Test(BaseModel): val: str = "test" class Foo(BaseModel): bar: Test = Field(description="test") quz: Test Foo.model_json_schema()

Environment

  • Python: 3.11
  • Pydantic: 2

What Broke

The generated JSON schema does not match the expected format, causing integration issues.

Why It Broke

The JSON schema incorrectly adds an allOf wrapper when a description is provided for a Field

Fix Options (Details)

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

pip install pydantic==1.10.18

When NOT to use: This fix should not be applied if the behavior of allOf is required for specific schema validation.

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

First fixed release: 1.10.18

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 the behavior of allOf is required for specific schema validation.

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.18 Fixed

Related Issues

No related fixes found.

Sources

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