@@ -86,14 +86,6 @@ def make_engine_value_decoder(
8686 or dst_annotation is inspect .Parameter .empty
8787 or dst_annotation is Any
8888 )
89- # Handle struct -> dict binding for explicit dict annotations
90- is_dict_annotation = False
91- if dst_annotation is dict :
92- is_dict_annotation = True
93- elif getattr (dst_annotation , "__origin__" , None ) is dict :
94- args = getattr (dst_annotation , "__args__" , ())
95- if args == (str , Any ):
96- is_dict_annotation = True
9789 if dst_is_any :
9890 if src_type_kind == "Union" :
9991 return lambda value : value [1 ]
@@ -105,6 +97,15 @@ def make_engine_value_decoder(
10597 f"It's required for { src_type_kind } type."
10698 )
10799 return lambda value : value
100+
101+ # Handle struct -> dict binding for explicit dict annotations
102+ is_dict_annotation = False
103+ if dst_annotation is dict :
104+ is_dict_annotation = True
105+ elif getattr (dst_annotation , "__origin__" , None ) is dict :
106+ args = getattr (dst_annotation , "__args__" , ())
107+ if args == (str , Any ):
108+ is_dict_annotation = True
108109 if is_dict_annotation and src_type_kind == "Struct" :
109110 return _make_engine_struct_to_dict_decoder (field_path , src_type ["fields" ])
110111
0 commit comments