frank-ye commented on code in PR #74666:
URL: https://github.com/apache/airflow/pull/74666#discussion_r4276687976


##########
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:
   Makes sense, switched to `skipkeys=True` and dropped the `list()` in 
e31f1751 - a bad key now only loses that key instead of the whole list thanks 
for the catch!



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