File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -61,10 +61,15 @@ def reconstruct_original_dataclass(self) -> Any:
61
61
if is_subclass (field_type , BasePolyConfig ):
62
62
config_type = getattr (self , f"{ original_field_name } _type" )
63
63
# find all subclasses of field_type and check which one matches the config_type
64
+ config_type_matched = False
64
65
for subclass in get_all_subclasses (field_type ):
65
66
if str (subclass .get_type ()) == config_type :
67
+ config_type_matched = True
66
68
args [original_field_name ] = instances [subclass ]
67
69
break
70
+ assert (
71
+ config_type_matched
72
+ ), f"Invalid type { config_type } for { prefixed_field_name } _type. Valid types: { [str (subclass .get_type ()) for subclass in get_all_subclasses (field_type )]} "
68
73
elif hasattr (field_type , "__dataclass_fields__" ):
69
74
args [original_field_name ] = instances [field_type ]
70
75
else :
You can’t perform that action at this time.
0 commit comments