File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -567,14 +567,13 @@ def get_config(name: str) -> Any:
567567 if isinstance (original_field , FieldInfo ):
568568 field = original_field
569569 else :
570- annotated_field_meta = new_cls .__annotations__ [k ].__dict__ .get (
571- "__metadata__" , []
572- )
570+ annotated_field = get_annotations (new_cls .__dict__ ).get (k , {})
571+ annotated_field_meta = getattr (annotated_field ,"__metadata__" , (()))
573572 field = next (
574573 (f for f in annotated_field_meta if isinstance (f , FieldInfo )), v
575574 ) # type: ignore[assignment]
576- field .annotation = v .annotation
577- # Guarantee the field has the correct type
575+ field .annotation = v .annotation
576+ # Guarantee the field has the correct type
578577 col = get_column_from_field (field )
579578 setattr (new_cls , k , col )
580579 # Set a config flag to tell FastAPI that this should be read with a field
You can’t perform that action at this time.
0 commit comments