@@ -166,7 +166,7 @@ def __init__(
166166 id = id ,
167167 name = name ,
168168 description = description ,
169- validators = validators ,
169+ validators = [] ,
170170 output_schema = model_schema ,
171171 history = history , # type: ignore - pyright doesn't understand pydantic overrides
172172 )
@@ -180,6 +180,9 @@ def __init__(
180180 # self.output_schema: Optional[ModelSchema] = None
181181 # self.history = history
182182
183+ ### Overrides ###
184+ self .validators = validators
185+
183186 ### Legacy ##
184187 self ._num_reasks = None
185188 self ._rail : Optional [str ] = None
@@ -208,7 +211,10 @@ def __init__(
208211 if loaded_guard :
209212 self .id = loaded_guard .id
210213 self .description = loaded_guard .description
211- self .validators = loaded_guard .validators or []
214+ self .validators = [ # type: ignore
215+ ValidatorReference .from_interface (v )
216+ for v in loaded_guard .validators or []
217+ ]
212218
213219 loaded_output_schema = (
214220 ModelSchema .from_dict ( # trims out extra keys
@@ -1376,7 +1382,7 @@ def to_dict(self) -> Dict[str, Any]:
13761382 id = self .id ,
13771383 name = self .name ,
13781384 description = self .description ,
1379- validators = self .validators ,
1385+ validators = self .validators , # type: ignore
13801386 output_schema = self .output_schema ,
13811387 history = [c .to_interface () for c in self .history ], # type: ignore
13821388 )
@@ -1416,7 +1422,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional["Guard"]:
14161422 id = i_guard .id ,
14171423 name = i_guard .name ,
14181424 description = i_guard .description ,
1419- validators = i_guard .validators ,
1425+ validators = [
1426+ ValidatorReference .from_interface (i_val )
1427+ for i_val in i_guard .validators or []
1428+ ],
14201429 output_schema = output_schema ,
14211430 )
14221431
0 commit comments