Skip to content

Commit

Permalink
fix: catch pydantic panic exception when validating field with skip_v…
Browse files Browse the repository at this point in the history
…alidation context
  • Loading branch information
simon-schoonjans committed Mar 29, 2024
1 parent b98c719 commit 19c7a86
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/waylay/sdk/api/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ def _model_validator(
raise
for field_name in model.model_fields_set:
field_value = getattr(model, field_name)
cls.__pydantic_validator__.validate_assignment(
model,
field_name,
field_value,
strict=(info.config or {}).get("strict"),
context=context,
)
strict = (info.config or {}).get("strict")
try:
cls.__pydantic_validator__.validate_assignment(
model,
field_name,
field_value,
strict=strict,
context=context,
)
except BaseException:
pass
return model
else:
raise
Expand Down

0 comments on commit 19c7a86

Please sign in to comment.