Skip to content

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