diff --git a/keep/api/models/db/mapping.py b/keep/api/models/db/mapping.py index 2f0e0ab79..64970c75a 100644 --- a/keep/api/models/db/mapping.py +++ b/keep/api/models/db/mapping.py @@ -60,8 +60,8 @@ class MappingRuleDtoOut(MappRuleDtoBase, extra="ignore"): class MappingRuleDtoIn(MappRuleDtoBase): rows: Optional[list[dict]] = None - @validator("type", pre=True, always=True) - def validate_type(cls, _type, values): - if _type == "csv" and not values.get("rows"): + @validator("rows", pre=True, always=True) + def validate_rows(cls, rows, values): + if not rows and values.get("type") == "csv": raise ValueError("Mapping of type CSV cannot have empty rows") - return _type + return rows