Taragolis commented on code in PR #40165:
URL: https://github.com/apache/airflow/pull/40165#discussion_r1633763500


##########
airflow/providers/yandex/operators/dataproc.py:
##########
@@ -37,6 +37,25 @@ class InitializationAction:
     timeout: int  # Execution timeout
 
 
+# These two functions are needed, since when render_as_native_obj=True, Jinja 
can deduce wrong types.
+# So we force elements to be string in API parameters
+# see https://github.com/apache/airflow/discussions/26336
+
+
+def force_dict_values_as_strings(dct: Optional[Dict[str, Any]]) -> 
Optional[Dict[str, str]]:
+    if dct is None:
+        return None
+
+    return {k: str(v) for k, v in dct.items()}
+
+
+def force_list_values_as_string(lst: Optional[Iterable[Any]]) -> List[str]:
+    if lst is None:
+        return None
+
+    return list(map(str, lst))
+
+

Review Comment:
   `from airflow.utils.template import literal`
   
   
https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/operators.html#jinja-templating



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

Reply via email to