#13784·pydantic

Support array unpacking in `AliasPath` for `validation_alias`

Author: gbdlinCreated Sep 9, 2026Updated Sep 17, 2026
Labelsfeature request

Initial Checks

  • I have searched Google & GitHub for similar requests and couldn't find anything
  • I have read and followed the docs and still think this feature is missing

Description

Allow for syntax that will result in unpacking a field from array of objects, presenting it as a simple array to the underlying object.

For example, given the data:

json
{
  "name": "Blog entry",
  "authors": [
    {"name": "Alice"}
    {"name": "Bob"}
  ]
}

there could be a simple way to parse it into an object structured as:

python
Blog(name="Blog entry", authors=["Alice", "Bob"])

Such syntax could look like:

python
class Blog(BaseModel):
    name: str
    authors: Annotated[list[str], Field(validation_alias=AliasPath("authors", ..., "name"))]

This syntax could be expanded into multiple iteration levels to "flatten" nested arrays, simply by using ... multiple times in AliasPath.

Affected Components