uranusjr commented on code in PR #57853:
URL: https://github.com/apache/airflow/pull/57853#discussion_r2496868297


##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -1707,6 +1707,25 @@ def set_task_dag_references(task: SerializedOperator | 
MappedOperator, dag: Seri
             # Bypass set_upstream etc here - it does more than we want
             dag.task_dict[task_id].upstream_task_ids.add(task.task_id)
 
+    @classmethod
+    @lru_cache(maxsize=1)  # Only one type: "operator"
+    def get_operator_const_fields(cls) -> set[str]:
+        schema_loader = cls._json_schema
+
+        if schema_loader is None:
+            return set()
+
+        schema_data = schema_loader.schema
+        operator_def = schema_data.get("definitions", {}).get("operator", {})
+        properties = operator_def.get("properties", {})
+
+        const_fields = set()
+        for field_name, field_def in properties.items():
+            if isinstance(field_def, dict) and field_def.get("const") is True:
+                const_fields.add(field_name)
+
+        return const_fields

Review Comment:
   ```suggestion
           return {
               field_name
               for field_name, field_def in properties.items()
               if isinstance(field_def, dict) and field_def.get("const") is True
           }
   ```
   
   Does the `is True` part need to be there? Is `field_def.get("const")` enough?



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