FastAPI 0.156.5 Fixes AliasChoices for Path Parameters

FastAPI·21 Oct 2026·2 min read

#fastapi

FastAPI 0.156.5 is a small patch release focused on a single bug fix: correct handling of AliasChoices for path parameters. The change lands in PR #16560, authored by @tiangolo, and targets a case where the validation alias machinery did not behave as expected when applied to parameters declared in the URL path rather than the query string or request body.

AliasChoices is part of the Pydantic validation alias API, allowing a field to accept several alternative input names. FastAPI exposes it through the alias, validation_alias and serialization_alias arguments on parameter declarations. Path parameters are a special case because their names must match the placeholder in the route template, which makes alias resolution more delicate than for query or body fields.

The concrete changes in this release:

  • Fix AliasChoices support for path parameters, so aliased path inputs are resolved through the intended lookup path (PR #16560).
  • Align path parameter behavior with the existing alias handling already used for query parameters, headers, cookies and body models.
  • No new public API, no deprecations and no breaking changes are introduced in this patch.

For developers, this matters because alias-based validation is often used during migrations or when integrating with external clients that send differently named fields. If an endpoint declares a path parameter whose accepted names are described with AliasChoices, versions before 0.156.5 could fail to match the request correctly. Upgrading with pip install --upgrade fastapi (or pinning fastapi==0.156.5) resolves that mismatch without requiring changes to your route signatures. As with any patch release, it is worth running your existing test suite after upgrading, particularly any tests that exercise routes with aliased path parameters, to confirm the behavior you rely on.

Source: https://github.com/fastapi/fastapi/releases/tag/0.156.5

Related

auto-curated · source linked above← all news