Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ignore ScheduledAction's omitempty when SupportHours is specified #549

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pw-mdb
Copy link

@pw-mdb pw-mdb commented Feb 5, 2025

Fixes #468. When Service.SupportHours is specified, Service.ScheduledActions is required, otherwise the PagerDuty API returns the following error:

HTTP response failed with status code 400, message: Invalid Input Provided (code: 2001): Scheduled actions is required.

This implements a custom MarshalJSON function for Service, which ignores ScheduledActions's omitempty when SupportHours is specified, and enforces it otherwise. This currently does not work, so existing users will not be impacted by this change.

Fixes PagerDuty#468. When `Service.SupportHours` is specified, `Service.ScheduledActions` is required, otherwise the PagerDuty API returns the following error:

```
HTTP response failed with status code 400, message: Invalid Input Provided (code: 2001): Scheduled actions is required.
```

This implements a custom `MarshalJSON` function for `Service`, which ignores `ScheduledActions`'s `omitempty` when `SupportHours` is specified, and enforces it otherwise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow passing empty scheduled actions
1 participant