Skip to content

Commit de90e16

Browse files
committed
🐛 Handle pydantic root validation errors
1 parent 0fb1f27 commit de90e16

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

flama/schemas/_libs/pydantic/adapter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ def validate(
7777
try:
7878
return schema_cls(**values).model_dump(exclude_unset=partial)
7979
except pydantic.ValidationError as errors:
80-
raise SchemaValidationError(errors={str(error["loc"][0]): error for error in errors.errors()})
80+
raise SchemaValidationError(
81+
errors={
82+
".".join(str(x) for x in error.get("loc", [])): error for error in errors.errors(include_url=False)
83+
}
84+
)
8185

8286
def load(self, schema: t.Union[Schema, type[Schema]], value: dict[str, t.Any]) -> Schema:
8387
schema_cls = self.unique_schema(schema)

0 commit comments

Comments
 (0)