-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow combining Field
annotations by merging them
#6398
Conversation
Deploying with Cloudflare Pages
|
@tiangolo I think this solves the problem you raised in #6336 (comment) |
if field_infos: | ||
annotations = [*non_field_infos, FieldInfo.merge_field_infos(*field_infos)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This re-ordering does have some possible consequences. In particular, each FieldInfo
currently hooks into __get_pydantic_core_schema__
on its own so the order matters. But this re-ordering says "even if everything else runs in the order it is put into Annotated, we do special handling for Field() so that it runs at the end".
please review |
Yesss! This solves it for me, and simplifies the code on FastAPI as I can now just use the If this goes in (and is released), I'll be able to make the final FastAPI beta, and then the final release in one or two days. 🚀 |
Fixes #6353, closes #6336
Selected Reviewer: @hramezani