Skip to content

Commit 41424a8

Browse files
committed
Addresses review comments
1 parent 9b4fab8 commit 41424a8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

RATapi/classlist.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def set_fields(self, index: int, **kwargs) -> None:
266266

267267
if importlib.util.find_spec("pydantic"):
268268
# Pydantic is installed, so set up a context manager that will
269-
# suppress validation errors until all fields have been set.
269+
# suppress custom validation errors until all fields have been set.
270270
from pydantic import BaseModel, ValidationError
271271

272272
if isinstance(self.data[index], BaseModel):
@@ -318,6 +318,9 @@ def __exit__(self, exctype, excinst, exctb):
318318
with validation_context:
319319
setattr(self.data[index], key, value)
320320

321+
# We have suppressed custom validation errors for pydantic objects.
322+
# We now must revalidate the pydantic model outside the validation context
323+
# to catch any errors that remain after setting all of the fields.
321324
if pydantic_object:
322325
self._class_handle.model_validate(self.data[index])
323326

0 commit comments

Comments
 (0)