Skip to content

Commit e4d79de

Browse files
Handle modified data type field
1 parent 17c5e00 commit e4d79de

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

web/server/models.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,24 @@ def validate_schema(
392392
v: t.Union[
393393
t.Dict[str, exp.DataType],
394394
t.List[t.Tuple[str, exp.DataType]],
395+
t.Dict[str, t.Tuple[exp.DataType, exp.DataType]],
395396
t.Dict[str, str],
396397
],
398+
info: ValidationInfo,
397399
) -> t.Dict[str, str]:
398400
if isinstance(v, dict):
399-
return {k: str(v) for k, v in v.items()}
401+
# Handle modified field which has tuples of (source_type, target_type)
402+
if info.field_name == "modified" and any(isinstance(val, tuple) for val in v.values()):
403+
return {
404+
k: f"{str(val[0])}{str(val[1])}"
405+
for k, val in v.items()
406+
if isinstance(val, tuple)
407+
and isinstance(val[0], exp.DataType)
408+
and isinstance(val[1], exp.DataType)
409+
}
410+
return {k: str(val) for k, val in v.items()}
400411
if isinstance(v, list):
401-
return {k: str(v) for k, v in v}
412+
return {k: str(val) for k, val in v}
402413
return v
403414

404415

0 commit comments

Comments
 (0)