The Fix
pip install pydantic==2.11.0
Based on closed pydantic/pydantic issue #11408 · 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%.
@@ -12,6 +12,8 @@
list: list,
typing.List: list, # noqa: UP006
+ tuple: tuple,
+ typing.Tuple: tuple, # noqa: UP006
set: set,
@pytest.fixture()
def expected_python_dict(self) -> dict[str, list[dict[str, str]]]:
return {
"items": [
{"firstName": "John", "lastName": "Doe"},
{"firstName": "Mary", "lastName": "Smith"},
]
}
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.11.0\nWhen NOT to use: This fix should not be applied if the alias_generator is not intended for use.\n\n
Why This Fix Works in Production
- Trigger: assert result == expected_python_dict
- Mechanism: The alias_generator was not applied to Sequence[Item] fields when dumping data
- Why the fix works: `TypeAdapter.dump_python` and `TypeAdapter.dump_json` now respect `alias_generator` for `Sequence[Item]` fields, fixing the serialization issue. (first fixed release: 2.11.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
- Shows up under Python 3.13 in real deployments (not just unit tests).
- The alias_generator was not applied to Sequence[Item] fields when dumping data
- Production symptom (often without a traceback): assert result == expected_python_dict
Proof / Evidence
- GitHub issue: #11408
- Fix PR: https://github.com/pydantic/pydantic/pull/11435
- First fixed release: 2.11.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.70
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Thanks for the report @rayansostenes! Looking into this and we'll release a fix in v2.11.”
Failure Signature (Search String)
- assert result == expected_python_dict
Copy-friendly signature
Failure Signature
-----------------
assert result == expected_python_dict
@pytest.mark.xfail(reason="This test fails, the keys are not in camel case as expected")
Error Message
Signature-only (no traceback captured)
Error Message
-------------
assert result == expected_python_dict
@pytest.mark.xfail(reason="This test fails, the keys are not in camel case as expected")
Minimal Reproduction
@pytest.fixture()
def expected_python_dict(self) -> dict[str, list[dict[str, str]]]:
return {
"items": [
{"firstName": "John", "lastName": "Doe"},
{"firstName": "Mary", "lastName": "Smith"},
]
}
Environment
- Python: 3.13
- Pydantic: 2
What Broke
Output JSON keys did not conform to alias generation rules, causing incorrect serialization.
Why It Broke
The alias_generator was not applied to Sequence[Item] fields when dumping data
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.11.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/11435
First fixed release: 2.11.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if the alias_generator is not intended for use.
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.11.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.