The Fix
pip install pydantic==2.6.0
Based on closed pydantic/pydantic issue #8888 · 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%.
@@ -82,6 +82,7 @@ class ConfigWrapper:
regex_engine: Literal['rust-regex', 'python-re']
validation_error_cause: bool
+ use_attribute_docstrings: bool
def __init__(self, config: ConfigDict | dict[str, Any] | type[Any] | None, *, check: bool = True):
from enum import StrEnum
class DocumentedStrEnum(StrEnum):
"""
Courtesy of Ethan Furman: https://stackoverflow.com/a/50473952
"""
def __new__(cls, value, doc=None):
self = str.__new__(cls)
self._value_ = value
if doc is not None:
self.__doc__ = doc
return self
class EvalMode(DocumentedStrEnum):
SYNCHRONOUS = "Synchronous", "execute synchronously and block until the task is completed"
ASYNCHRONOUS = "Asynchronous", "kick off execution in the background and return immediately"
assert EvalMode.SYNCHRONOUS.__doc__ == "execute synchronously and block until the task is completed"
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==2.6.0\nWhen NOT to use: This fix should not be used if backward compatibility with existing JSON Schema tooling is a concern.\n\n
Why This Fix Works in Production
- Trigger: Render Enum Member Docstrings in JSON Schema
- Mechanism: The JSON Schema output did not include descriptions for enum members, limiting documentation capabilities
- Why the fix works: Adds a `json_schema_literal_type` config field to generate properties using `oneOf` with `const` instead of the default `enum`, allowing for better documentation of enum members in JSON Schema. (first fixed release: 2.6.0).
- 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
- The JSON Schema output did not include descriptions for enum members, limiting documentation capabilities
- Production symptom (often without a traceback): Render Enum Member Docstrings in JSON Schema
Proof / Evidence
- GitHub issue: #8888
- Fix PR: https://github.com/pydantic/pydantic/pull/6563
- First fixed release: 2.6.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.56
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Closing this per the discussion here and in the PR. I might bring this back up as a change in default behavior when V3 is…”
“Closing based on https://github.com/pydantic/pydantic/pull/9029#issuecomment-2155012411 🚀 !”
“Sounds great, thanks @sydney-runkle! I'll submit a PR using the same opt-in mechanism as as the new docstring support.”
“Apologies for the back and forth here, but on a closer look I don't think GenerateJsonSchema subclassing is an option here.”
Failure Signature (Search String)
- Render Enum Member Docstrings in JSON Schema
- 1. Migrate JSON Schema output of multiple literal values from `enum` to `oneOf` + `const`
Copy-friendly signature
Failure Signature
-----------------
Render Enum Member Docstrings in JSON Schema
1. Migrate JSON Schema output of multiple literal values from `enum` to `oneOf` + `const`
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Render Enum Member Docstrings in JSON Schema
1. Migrate JSON Schema output of multiple literal values from `enum` to `oneOf` + `const`
Minimal Reproduction
from enum import StrEnum
class DocumentedStrEnum(StrEnum):
"""
Courtesy of Ethan Furman: https://stackoverflow.com/a/50473952
"""
def __new__(cls, value, doc=None):
self = str.__new__(cls)
self._value_ = value
if doc is not None:
self.__doc__ = doc
return self
class EvalMode(DocumentedStrEnum):
SYNCHRONOUS = "Synchronous", "execute synchronously and block until the task is completed"
ASYNCHRONOUS = "Asynchronous", "kick off execution in the background and return immediately"
assert EvalMode.SYNCHRONOUS.__doc__ == "execute synchronously and block until the task is completed"
What Broke
Users were unable to see detailed descriptions for enum values in JSON Schema, affecting usability.
Why It Broke
The JSON Schema output did not include descriptions for enum members, limiting documentation capabilities
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.6.0
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/6563
First fixed release: 2.6.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if backward compatibility with existing JSON Schema tooling is a concern.
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 |
|---|---|
| 2.6.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.