Andrushika commented on code in PR #77523:
URL: https://github.com/apache/airflow/pull/77523#discussion_r4676717482


##########
task-sdk/src/airflow/sdk/serde/serializers/kubernetes.py:
##########
@@ -55,10 +57,45 @@ def safe_get_name(pod):
                 return None
 
         try:
-            return PodGenerator.serialize_pod(o), qualname(o), __version__, 
True
+            return ApiClient().sanitize_for_serialization(o), qualname(o), 
__version__, True
         except Exception:
             log.warning("Serialization failed for pod %s", safe_get_name(o))
             log.debug("traceback for serialization error", exc_info=True)
             return "", "", 0, False
 
     return "", "", 0, False
+
+
+def deserialize(cls: type, version: int, data: dict) -> Any:
+    import pydantic
+
+    if version > __version__:
+        raise TypeError(f"serialized version {version} is newer than class 
version {__version__}")
+
+    if not hasattr(cls, "model_validate"):

Review Comment:
   Looks like `pydantic.py` already has a check for this, maybe we can reuse it 
here?
   
   ``` python
   from airflow.sdk.serde.typing import is_pydantic_model
   ```



-- 
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]

Reply via email to