shahar1 opened a new issue, #73431: URL: https://github.com/apache/airflow/issues/73431
## Summary Make the Cloud Monitoring list operators preserve the hook output when `format_` is explicitly set. Currently, `format_="dict"` and `format_="json"` both fail with a `TypeError`. ## Background `CloudMonitoringHook.list_alert_policies()` and `list_notification_channels()` already honor `format_`: `"dict"` returns dictionaries, `"json"` returns JSON strings, and `None` returns protobuf objects. The corresponding operators then unconditionally call `AlertPolicy.to_dict()` or `NotificationChannel.to_dict()` on every result. That conversion only accepts protobuf objects, so passing an already-converted dictionary or JSON string raises `TypeError`. The operators should return the hook result unchanged when `format_` is set. With `format_=None`, they should continue converting protobuf objects to dictionaries so the value remains XCom-serializable. Update the operator-level `format_` documentation to describe this behavior. ## Where to look - `providers/google/src/airflow/providers/google/cloud/operators/cloud_monitoring.py` — `CloudMonitoringListAlertPoliciesOperator.execute` and `CloudMonitoringListNotificationChannelsOperator.execute`. - `providers/google/src/airflow/providers/google/cloud/hooks/cloud_monitoring.py` — the existing return-format behavior. - `providers/google/tests/unit/google/cloud/operators/test_cloud_monitoring.py` — unit tests for both operators. ## Acceptance criteria - [ ] Both list operators return dictionaries unchanged with `format_="dict"`. - [ ] Both list operators return JSON strings unchanged with `format_="json"`. - [ ] With no `format_`, both operators still convert protobuf objects to dictionaries for XCom serialization. - [ ] Add focused unit-test coverage for the corrected behavior in both operators. - [ ] Update the operator `format_` parameter documentation to accurately state the returned type. ## Estimated effort About 1–2 hours for someone new to the codebase. ## Getting started See [Apache Airflow’s contributor quick start](https://github.com/apache/airflow/blob/main/contributing-docs/03a_contributors_quick_start_beginners.rst). --- This issue was drafted with AI assistance and reviewed by a maintainer before filing. -- 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]
