kacpermuda commented on code in PR #74666:
URL: https://github.com/apache/airflow/pull/74666#discussion_r4271729161


##########
providers/openlineage/src/airflow/providers/openlineage/utils/utils.py:
##########
@@ -2203,6 +2209,15 @@ class AirflowContextDeprecationWarning(UserWarning):
         return item
 
 
+def _convert_to_json_safe_list(value: Collection, name: str) -> list | None:
+    """Return ``value`` as a list of JSON-native types, casting 
non-serializable values with ``str()``."""
+    try:
+        return json.loads(json.dumps(list(value), default=str))
+    except (TypeError, ValueError) as e:
+        log.warning("Unable to serialize task `%s` to a JSON list: %s", name, 
e)
+        return None
+
+

Review Comment:
   list() is probably not needed here, they are already lists, but I get that 
the helper is more generic. Also, we can think about using skipkeys=True 
instead of discarding the whole value here, but that's your choice - if we want 
to keep any outlets/inlets just without broken keys or show that its missing, I 
think the first option makes sense



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