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

JSON fixes for optional fields #15

Merged
merged 3 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions checkly_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ var wantCheck = checkly.Check{
},
LocalSetupScript: "setitup",
LocalTearDownScript: "tearitdown",
AlertSettings: checkly.AlertSettings{
AlertSettings: &checkly.AlertSettings{
EscalationType: checkly.RunBased,
RunBasedEscalation: checkly.RunBasedEscalation{
RunBasedEscalation: &checkly.RunBasedEscalation{
FailedRunThreshold: 1,
},
TimeBasedEscalation: checkly.TimeBasedEscalation{
TimeBasedEscalation: &checkly.TimeBasedEscalation{
MinutesFailingThreshold: 5,
},
Reminders: checkly.Reminders{
Reminders: &checkly.Reminders{
Interval: 5,
},
SSLCertificates: checkly.SSLCertificates{
SSLCertificates: &checkly.SSLCertificates{
Enabled: false,
AlertThreshold: 30,
},
Expand Down Expand Up @@ -291,17 +291,17 @@ var wantGroup = checkly.Group{
UseGlobalAlertSettings: false,
AlertSettings: checkly.AlertSettings{
EscalationType: checkly.RunBased,
RunBasedEscalation: checkly.RunBasedEscalation{
RunBasedEscalation: &checkly.RunBasedEscalation{
FailedRunThreshold: 1,
},
TimeBasedEscalation: checkly.TimeBasedEscalation{
TimeBasedEscalation: &checkly.TimeBasedEscalation{
MinutesFailingThreshold: 5,
},
Reminders: checkly.Reminders{
Reminders: &checkly.Reminders{
Amount: 0,
Interval: 5,
},
SSLCertificates: checkly.SSLCertificates{
SSLCertificates: &checkly.SSLCertificates{
Enabled: true,
AlertThreshold: 30,
},
Expand Down
18 changes: 9 additions & 9 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ type Check struct {
TearDownSnippetID *int64 `json:"tearDownSnippetId"`
LocalSetupScript string `json:"localSetupScript"`
LocalTearDownScript string `json:"localTearDownScript"`
AlertSettings AlertSettings `json:"alertSettings,omitempty"`
AlertSettings *AlertSettings `json:"alertSettings,omitempty"`
UseGlobalAlertSettings bool `json:"useGlobalAlertSettings"`
Request Request `json:"request"`
GroupID *int64 `json:"groupId"`
Expand All @@ -226,9 +226,9 @@ type Request struct {
FollowRedirects bool `json:"followRedirects"`
Body string `json:"body"`
BodyType string `json:"bodyType,omitempty"`
Headers []KeyValue `json:"headers"`
QueryParameters []KeyValue `json:"queryParameters"`
Assertions []Assertion `json:"assertions"`
Headers []KeyValue `json:"headers,omitempty"`
QueryParameters []KeyValue `json:"queryParameters,omitempty"`
Assertions []Assertion `json:"assertions,omitempty"`
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
}

Expand Down Expand Up @@ -269,11 +269,11 @@ type EnvironmentVariable struct {

// AlertSettings represents an alert configuration.
type AlertSettings struct {
EscalationType string `json:"escalationType,omitempty"`
RunBasedEscalation RunBasedEscalation `json:"runBasedEscalation,omitempty"`
TimeBasedEscalation TimeBasedEscalation `json:"timeBasedEscalation,omitempty"`
Reminders Reminders `json:"reminders,omitempty"`
SSLCertificates SSLCertificates `json:"sslCertificates,omitempty"`
EscalationType string `json:"escalationType,omitempty"`
RunBasedEscalation *RunBasedEscalation `json:"runBasedEscalation,omitempty"`
TimeBasedEscalation *TimeBasedEscalation `json:"timeBasedEscalation,omitempty"`
Reminders *Reminders `json:"reminders,omitempty"`
SSLCertificates *SSLCertificates `json:"sslCertificates,omitempty"`
}

// RunBasedEscalation represents an alert escalation based on a number of failed
Expand Down