Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions pyiceberg/table/name_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,6 @@ class MappedField(IcebergBaseModel):
def convert_null_to_empty_List(cls, v: Any) -> Any:
return v or []

@field_validator("names", mode="after")
@classmethod
def check_at_least_one(cls, v: List[str]) -> Any:
"""
Conlist constraint does not seem to be validating the class on instantiation.

Adding a custom validator to enforce min_length=1 constraint.
"""
if len(v) < 1:
raise ValueError("At least one mapped name must be provided for the field")
return v

@model_serializer
def ser_model(self) -> Dict[str, Any]:
"""Set custom serializer to leave out the field when it is empty."""
Expand Down