Jump to solution
Verify

The Fix

pip install pydantic==1.10.18

Based on closed pydantic/pydantic issue #10163 · 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
@@ -748,7 +748,7 @@ def literal_schema(self, schema: core_schema.LiteralSchema) -> JsonSchemaValue: result['type'] = 'integer' elif types == {float}: - result['type'] = 'numeric' + result['type'] = 'number' elif types == {bool}:
repro.py
from enum import Enum import pprint from pydantic import BaseModel class FloatEnum(float, Enum): A = 0.1 B = 0.2 class Param(BaseModel): score_threshold: FloatEnum pprint.pprint(Param.model_json_schema()) # Outputs: # {'$defs': {'FloatEnum': {'enum': [0.1, 0.2], # 'title': 'FloatEnum', # 'type': 'numeric'}}, # 'properties': {'score_threshold': {'$ref': '#/$defs/FloatEnum'}}, # 'required': ['score_threshold'], # 'title': 'Param', # 'type': 'object'}
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: Do not apply this fix if the JSON Schema type 'numeric' is required by your application.\n\n

Why This Fix Works in Production

  • Trigger: JSON Schema serialization of FloatEnums incorrectly assigns type 'numeric'
  • Mechanism: The enum_schema() method incorrectly assigns type 'numeric' instead of 'number' for FloatEnums
  • Why the fix works: Fixes the JSON Schema type assignment for FloatEnums from 'numeric' to 'number'. (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 enum_schema() method incorrectly assigns type 'numeric' instead of 'number' for FloatEnums
  • Production symptom (often without a traceback): JSON Schema serialization of FloatEnums incorrectly assigns type 'numeric'

Proof / Evidence

Discussion

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

“Thanks for the clear example. This will be fixed in https://github.com/pydantic/pydantic/pull/10172.”
@Viicos · 2024-08-19 · confirmation · source

Failure Signature (Search String)

  • JSON Schema serialization of FloatEnums incorrectly assigns type 'numeric'
  • This causes issue with downstream tasks, where correct Json Schemas are expected. If I have misunderstood / misplaced the cause, I'm sorry! :sweat_smile:
Copy-friendly signature
signature.txt
Failure Signature ----------------- JSON Schema serialization of FloatEnums incorrectly assigns type 'numeric' This causes issue with downstream tasks, where correct Json Schemas are expected. If I have misunderstood / misplaced the cause, I'm sorry! :sweat_smile:

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- JSON Schema serialization of FloatEnums incorrectly assigns type 'numeric' This causes issue with downstream tasks, where correct Json Schemas are expected. If I have misunderstood / misplaced the cause, I'm sorry! :sweat_smile:

Minimal Reproduction

repro.py
from enum import Enum import pprint from pydantic import BaseModel class FloatEnum(float, Enum): A = 0.1 B = 0.2 class Param(BaseModel): score_threshold: FloatEnum pprint.pprint(Param.model_json_schema()) # Outputs: # {'$defs': {'FloatEnum': {'enum': [0.1, 0.2], # 'title': 'FloatEnum', # 'type': 'numeric'}}, # 'properties': {'score_threshold': {'$ref': '#/$defs/FloatEnum'}}, # 'required': ['score_threshold'], # 'title': 'Param', # 'type': 'object'}

Environment

  • Python: 3.11
  • Pydantic: 2

What Broke

Incorrect JSON Schema type assignment leads to downstream validation failures.

Why It Broke

The enum_schema() method incorrectly assigns type 'numeric' instead of 'number' for FloatEnums

Fix Options (Details)

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

pip install pydantic==1.10.18

When NOT to use: Do not apply this fix if the JSON Schema type 'numeric' is required by your application.

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

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

  • Do not apply this fix if the JSON Schema type 'numeric' is required by your application.

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.