uranusjr commented on code in PR #28777: URL: https://github.com/apache/airflow/pull/28777#discussion_r1064248601
########## airflow/www/utils.py: ########## @@ -133,13 +133,25 @@ def get_mapped_summary(parent_instance, task_instances): def get_dag_run_conf(dag_run_conf: Any) -> tuple[str | None, bool]: + class DagRunConfEncoder(json.JSONEncoder): + def default(self, obj): + if isinstance(obj, bytes): + try: + return obj.decode() + except Exception: + return str(obj) + try: + return json.JSONEncoder.default(self, obj) + except Exception: + return str(obj) Review Comment: I just checked and indeed this function is only used in `views.py`. However since there’s no way to tell whether it’s also used by user code somewhere (backward compatibility concerns), it’s probably better to make the function signature something like this: ```python def get_dag_run_conf( dag_run_conf: Any, *, json_encoder: Type[json.JSONEncoder] = json.JSONEncoder, ) -> tuple[str | None, bool]: ... ``` and we can move `DagRunConfEncoder` to `vies.py` as a private class. -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org