bito-code-review[bot] commented on PR #42850:
URL: https://github.com/apache/superset/pull/42850#issuecomment-5207537625
<!-- Bito Reply -->
The flagged issue is correct. The new validator in
`superset/reports/schemas.py` enforces Slack channel IDs for both `Slack` and
`SlackV2` types, which breaks legacy Slack recipients that rely on channel
names. To resolve this, the validation should be restricted to `SlackV2` or
updated to handle legacy name resolution.
To implement this fix, update the `validate_slack_recipients` method to only
apply the ID-only validation when the type is `SlackV2`:
```python
@validates_schema
def validate_slack_recipients(self, data: dict[str, Any], **kwargs: Any)
-> None:
if data.get("type") != ReportRecipientType.SLACKV2.value:
return
target = ((data.get("recipient_config_json") or {}).get("target") or
"").strip()
# ... (rest of the validation logic)
```
Would you like me to fetch all other comments on this PR to validate and
implement fixes for them as well?
**superset/reports/schemas.py**
```
@validates_schema
def validate_slack_recipients(self, data: dict[str, Any], **kwargs: Any)
-> None:
if data.get("type") != ReportRecipientType.SLACKV2.value:
return
target = ((data.get("recipient_config_json") or {}).get("target") or
"").strip()
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]