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

nullable/ommitempty fixes #275

Merged
merged 1 commit into from
Mar 15, 2024
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
2 changes: 1 addition & 1 deletion carrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type CarrierServiceOp struct {
// CarrierService represents a Shopify carrier service
type CarrierService struct {
// Whether this carrier service is active.
Active bool `json:"active,omitempty"`
Active *bool `json:"active"`

// The URL endpoint that Shopify needs to retrieve shipping rates. This must be a public URL.
CallbackUrl string `json:"callback_url,omitempty"`
Expand Down
16 changes: 12 additions & 4 deletions carrier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ func TestCarrierList(t *testing.T) {
t.Errorf("Carrier.List returned error: %v", err)
}

trueVar := true

expected := []CarrierService{
{
Id: 1,
Name: "Shipping Rate Provider",
Active: true,
Active: &trueVar,
ServiceDiscovery: true,
CarrierServiceType: "api",
AdminGraphqlApiId: "gid://shopify/DeliveryCarrierService/1",
Expand All @@ -50,10 +52,12 @@ func TestCarrierGet(t *testing.T) {
t.Errorf("Carrier.Get returned error: %v", err)
}

trueVar := true

expected := &CarrierService{
Id: 1,
Name: "Shipping Rate Provider",
Active: true,
Active: &trueVar,
ServiceDiscovery: true,
CarrierServiceType: "api",
AdminGraphqlApiId: "gid://shopify/DeliveryCarrierService/1",
Expand All @@ -77,10 +81,12 @@ func TestCarrierCreate(t *testing.T) {
t.Errorf("Carrier.Create returned error: %v", err)
}

trueVar := true

expected := &CarrierService{
Id: 1,
Name: "Shipping Rate Provider",
Active: true,
Active: &trueVar,
ServiceDiscovery: true,
CarrierServiceType: "api",
AdminGraphqlApiId: "gid://shopify/DeliveryCarrierService/1",
Expand All @@ -104,10 +110,12 @@ func TestCarrierUpdate(t *testing.T) {
t.Errorf("Carrier.Update returned error: %v", err)
}

trueVar := true

expected := &CarrierService{
Id: 1,
Name: "Shipping Rate Provider",
Active: true,
Active: &trueVar,
ServiceDiscovery: true,
CarrierServiceType: "api",
AdminGraphqlApiId: "gid://shopify/DeliveryCarrierService/1",
Expand Down
Loading