#12029·pydantic

JSON schema for enum of lists missing `items` parameter

Author: pranjalv123Created Jun 30, 2025Updated Sep 27, 2026
Labelsfeature requesttopic-enums

Initial Checks

  • I confirm that I'm using Pydantic V2

Description

The JSON schema for an enum of arrays doesn't include the items property, and therefore isn't valid JSON schema.

See the example for details.

Example Code

python
class StringListEnum(Enum):
     value: list[str] = ["foo", "bar", "baz"]

TypeAdapter(StringListEnum).json_schema()

# returns {'enum': [['foo', 'bar', 'baz']], 'title': 'StringListEnum', 'type': 'array'}

# should return {'enum': [['foo', 'bar', 'baz']], 'title': 'StringListEnum', 'type': 'array', 'items': 'string'}

Python, Pydantic & OS Version

pydantic version: 2.11.1
        pydantic-core version: 2.33.0
          pydantic-core build: profile=release pgo=false
               python version: 3.12.9 (main, Feb  4 2025, 14:38:38) [Clang 19.1.7 ]
                     platform: macOS-15.3.2-arm64-arm-64bit
             related packages: pydantic-extra-types-2.10.2 mypy-1.15.0 typing_extensions-4.12.2 email-validator-2.1.0.post1 pydantic-settings-2.10.1
                       commit: unknown