Jump to solution
Verify

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%.

Jump to Verify Open PR/Commit
@@ -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):
repro.py
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"
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.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).
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

  • 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

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…”
@rmehyde · 2024-03-19 · confirmation · source
“Closing based on https://github.com/pydantic/pydantic/pull/9029#issuecomment-2155012411 🚀 !”
@sydney-runkle · 2024-06-07 · confirmation · source
“Sounds great, thanks @sydney-runkle! I'll submit a PR using the same opt-in mechanism as as the new docstring support.”
@rmehyde · 2024-03-10 · source
“Apologies for the back and forth here, but on a closer look I don't think GenerateJsonSchema subclassing is an option here.”
@rmehyde · 2024-03-24 · source

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
signature.txt
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.txt
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

repro.py
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

When NOT to use: This fix should not be used if backward compatibility with existing JSON Schema tooling is a concern.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

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

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