Skip to content

Use validation_alias for embedded bodies - #16

Merged
Siyet merged 2 commits into
mainfrom
validation-alias
Nov 16, 2026
Merged

Siyet merged 2 commits into
mainfrom
validation-alias

Conversation

@Siyet

@Siyet Siyet commented Nov 16, 2026

Copy link
Copy Markdown
Owner

On non-streaming routes, Body(embed=True, validation_alias=...) was ignored: the embedded body key was alias or the parameter name, unlike plain FastAPI, where the key is a string validation_alias. A body sent under validation_alias was rejected, or replaced by the default when the body was optional. Now this validation_alias is the key in the request, in error locations and in the OpenAPI schema. This also corrects the request schema of streaming routes, where the request key was already right.

As in FastAPI, AliasChoices and AliasPath do not change the key read from an embedded body.

@Siyet
Siyet merged commit d774e97 into main Nov 16, 2026
18 checks passed
@Siyet
Siyet deleted the validation-alias branch November 16, 2026 16:47
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