feat: Create/Update changes for RSS feed notif channel support#2397
Open
neilv-g wants to merge 1 commit intoneilv-rss-2from
Open
feat: Create/Update changes for RSS feed notif channel support#2397neilv-g wants to merge 1 commit intoneilv-rss-2from
neilv-g wants to merge 1 commit intoneilv-rss-2from
Conversation
The Read and Delete NotifChannel APIs should work as is and not need any changes for RSS feeds.
jcscottiii
approved these changes
Apr 8, 2026
Collaborator
jcscottiii
left a comment
There was a problem hiding this comment.
LGTM with two nits to help. Feel free to do those now or in a follow up.
Comment on lines
+52
to
56
| } else if cfg, err := request.Config.AsRSSConfig(); err == nil && | ||
| cfg.Type == backend.RSSConfigTypeRss { | ||
| // RSS channels currently have no configuration fields to validate. | ||
| _ = cfg | ||
| } else { |
| } | ||
| } else if cfg, err := input.Config.AsRSSConfig(); err == nil && cfg.Type == backend.RSSConfigTypeRss { | ||
| // RSS channels currently have no configuration fields to validate. | ||
| _ = cfg |
Collaborator
There was a problem hiding this comment.
I think it's time we leverage the switch case (and get coverage from the exhaustive) linter. Feel free to do this in this PR or a follow up:
func validateUpdateNotificationChannel(request *backend.UpdateNotificationChannelRequest) fieldErrors {
var fieldErrors &fieldValidationErrors{fieldErrorMap: nil}
if len(input.Name) < notificationChannelNameMinLength || len(input.Name) > notificationChannelNameMaxLength {
fieldErrors.addFieldError("name", errNotificationChannelInvalidNameLength)
}
// 1. Get the explicit type discriminator from the JSON
discriminator, err := request.Config.Discriminator()
if err != nil {
fieldErrors.addFieldError("config", errors.New("invalid configuration structure"))
return fieldErrors
}
// 2. Switch on the type (cast to enum for exhaustiveness and type safety)
switch backend.NotificationChannelType(discriminator) {
case backend.NotificationChannelTypeRss:
// Valid! RSS channels currently have no configuration fields to validate.
// No variable is created, so no unused variable issue.
case backend.NotificationChannelTypeWebhook:
cfg, err := request.Config.AsWebhookConfig()
if err != nil {
fieldErrors.addFieldError("config", errors.New("invalid webhook config"))
break
}
if err := httputils.ValidateSlackWebhookURL(cfg.Url); err != nil {
fieldErrors.addFieldError("config.url", err)
}
case backend.NotificationChannelTypeEmail:
// Explicitly fall through to default since email channels
// cannot be managed manually via this endpoint.
fallthrough
default:
fieldErrors.addFieldError("config", errors.New("invalid config: only webhook or rss updates are supported"))
}
if fieldErrors.hasErrors() {
return fieldErrors
}
return nil
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Read and Delete NotifChannel APIs should work as is and not need any changes for RSS feeds.