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

AlertSettings field of Check struct should be a pointer value #13

Open
devillecodes opened this issue Nov 26, 2020 · 0 comments
Open

AlertSettings field of Check struct should be a pointer value #13

devillecodes opened this issue Nov 26, 2020 · 0 comments
Assignees
Labels
type: bug Something isn't working

Comments

@devillecodes
Copy link

devillecodes commented Nov 26, 2020

The AlertSettings field of the Check struct is currently a struct. The result is that when this field is omitted, the resulting JSON still contains the value. This is not what the API expects or what is documented in the API docs.

This can be see here: https://play.golang.org/p/cupZglCunSx
Which prints:

{"alertSettings":{"runBasedEscalation":{},"timeBasedEscalation":{},"reminders":{},"sslCertificates":{"enabled":false,"alertThreshold":0}}}

If you were to change the AlertSettings field to a pointer type, the resulting JSON will be what's expected.

This can be seen here: https://play.golang.org/p/YbWYjwaW3RU
Which prints:

{}

This is also true for the subfields of AlertSettings:

  • RunBasedEscalation
  • TimeBasedEscalation
  • Reminders
  • SSLCertificates
devillecodes added a commit to devillecodes/checkly-go-sdk that referenced this issue Nov 26, 2020
@ianaya89 ianaya89 self-assigned this Jun 16, 2021
ianaya89 pushed a commit that referenced this issue Jul 6, 2021
* make AlertSettings pointer types; fixes #13

* add omitempty to optional slices; fixes #14

Co-authored-by: Nacho Anaya <[email protected]>
@ianaya89 ianaya89 added the type: bug Something isn't working label Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants