rdblue commented on code in PR #7782:
URL: https://github.com/apache/iceberg/pull/7782#discussion_r1295074820


##########
python/pyiceberg/table/snapshots.py:
##########
@@ -59,34 +58,19 @@ class Summary(IcebergBaseModel):
     like snapshot expiration, to skip processing certain snapshots.
     """
 
-    __root__: Dict[str, Union[str, Operation]]
+    operation: Operation = Field()
     _additional_properties: Dict[str, str] = PrivateAttr()
 
-    @root_validator
-    def check_operation(cls, values: Dict[str, Dict[str, Union[str, 
Operation]]]) -> Dict[str, Dict[str, Union[str, Operation]]]:
-        if operation := values["__root__"].get(OPERATION):
-            if isinstance(operation, str):
-                values["__root__"][OPERATION] = Operation(operation.lower())
-        else:
-            raise ValueError("Operation not set")
-        return values
-
-    def __init__(
-        self, operation: Optional[Operation] = None, __root__: 
Optional[Dict[str, Union[str, Operation]]] = None, **data: Any
-    ) -> None:
-        super().__init__(__root__={"operation": operation, **data} if not 
__root__ else __root__)
-        self._additional_properties = {
-            k: v for k, v in self.__root__.items() if k != OPERATION  # type: 
ignore # We know that they are all string, and we don't want to check
-        }
+    def __init__(self, operation: Optional[Operation] = None, **data: Any) -> 
None:

Review Comment:
   While `operation` was not originally written, it should always be there so 
we don't necessarily need it to be `Optional`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to