Skip to content

🐛 Fix PEP 695 sequence aliases in form models - #16111

Open
KSmanis wants to merge 1 commit into
fastapi:masterfrom
KSmanis:fix/pep695-form-list-alias
Open

🐛 Fix PEP 695 sequence aliases in form models#16111
KSmanis wants to merge 1 commit into
fastapi:masterfrom
KSmanis:fix/pep695-form-list-alias

Conversation

@KSmanis

@KSmanis KSmanis commented Jul 30, 2026

Copy link
Copy Markdown

Summary

PEP 695 type aliases that resolve to sequence types are classified as scalar annotations when extracting form data. FastAPI consequently calls FormData.get() instead of FormData.getlist(), so only the final repeated value reaches Pydantic.

This change unwraps TypeAliasType before sequence detection and extends the existing form-model tests to cover both plain and aliased list fields.

Related discussion: #16100

@codspeed-hq

codspeed-hq Bot commented Jul 30, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing KSmanis:fix/pep695-form-list-alias (480ff0e) with master (95f8322)

Open in CodSpeed

@KSmanis
KSmanis marked this pull request as ready for review July 30, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant