From 4ae1030d6f7be5706e5cd4673380db13685adb11 Mon Sep 17 00:00:00 2001 From: CaitlynStocker Date: Thu, 9 Apr 2026 14:07:04 +1000 Subject: [PATCH 1/3] Remove omit empties --- pkg/channels/channel.go | 2 +- pkg/channels/channel_custom_field_definition.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/channels/channel.go b/pkg/channels/channel.go index 8b01c2a2..00872e12 100644 --- a/pkg/channels/channel.go +++ b/pkg/channels/channel.go @@ -10,7 +10,7 @@ import ( ) type Channel struct { - CustomFieldDefinitions []ChannelCustomFieldDefinition `json:"CustomFieldDefinitions,omitempty"` + CustomFieldDefinitions []ChannelCustomFieldDefinition `json:"CustomFieldDefinitions"` Description string `json:"Description,omitempty"` EphemeralEnvironmentNameTemplate string `json:"EphemeralEnvironmentNameTemplate,omitempty"` IsDefault bool `json:"IsDefault"` diff --git a/pkg/channels/channel_custom_field_definition.go b/pkg/channels/channel_custom_field_definition.go index 3e3984c1..39a99001 100644 --- a/pkg/channels/channel_custom_field_definition.go +++ b/pkg/channels/channel_custom_field_definition.go @@ -1,6 +1,6 @@ package channels type ChannelCustomFieldDefinition struct { - FieldName string `json:"FieldName,omitempty"` - Description string `json:"Description,omitempty"` + FieldName string `json:"FieldName"` + Description string `json:"Description"` } From 2b668236d140a562cbb7bcef65ab97f42f982b49 Mon Sep 17 00:00:00 2001 From: CaitlynStocker Date: Fri, 10 Apr 2026 11:21:44 +1000 Subject: [PATCH 2/3] Use pointers instead and don't clear indiv fields --- pkg/channels/channel.go | 4 ++-- pkg/channels/channel_custom_field_definition.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/channels/channel.go b/pkg/channels/channel.go index 00872e12..7fd88987 100644 --- a/pkg/channels/channel.go +++ b/pkg/channels/channel.go @@ -10,7 +10,7 @@ import ( ) type Channel struct { - CustomFieldDefinitions []ChannelCustomFieldDefinition `json:"CustomFieldDefinitions"` + CustomFieldDefinitions *[]ChannelCustomFieldDefinition `json:"CustomFieldDefinitions,omitempty"` Description string `json:"Description,omitempty"` EphemeralEnvironmentNameTemplate string `json:"EphemeralEnvironmentNameTemplate,omitempty"` IsDefault bool `json:"IsDefault"` @@ -37,7 +37,7 @@ func NewChannel(name string, projectID string) *Channel { TenantTags: []string{}, GitReferenceRules: []string{}, GitResourceRules: []ChannelGitResourceRule{}, - CustomFieldDefinitions: []ChannelCustomFieldDefinition{}, + CustomFieldDefinitions: &[]ChannelCustomFieldDefinition{}, Resource: *resources.NewResource(), } } diff --git a/pkg/channels/channel_custom_field_definition.go b/pkg/channels/channel_custom_field_definition.go index 39a99001..3e3984c1 100644 --- a/pkg/channels/channel_custom_field_definition.go +++ b/pkg/channels/channel_custom_field_definition.go @@ -1,6 +1,6 @@ package channels type ChannelCustomFieldDefinition struct { - FieldName string `json:"FieldName"` - Description string `json:"Description"` + FieldName string `json:"FieldName,omitempty"` + Description string `json:"Description,omitempty"` } From 845b3652cb8c136a7116d8f7e10cca6a5f6d2f98 Mon Sep 17 00:00:00 2001 From: CaitlynStocker Date: Fri, 10 Apr 2026 12:46:44 +1000 Subject: [PATCH 3/3] Default to nil when omitted --- pkg/channels/channel.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/channels/channel.go b/pkg/channels/channel.go index 7fd88987..be2d509a 100644 --- a/pkg/channels/channel.go +++ b/pkg/channels/channel.go @@ -31,14 +31,13 @@ type Channel struct { func NewChannel(name string, projectID string) *Channel { return &Channel{ - Name: strings.TrimSpace(name), - ProjectID: projectID, - Rules: []ChannelRule{}, - TenantTags: []string{}, - GitReferenceRules: []string{}, - GitResourceRules: []ChannelGitResourceRule{}, - CustomFieldDefinitions: &[]ChannelCustomFieldDefinition{}, - Resource: *resources.NewResource(), + Name: strings.TrimSpace(name), + ProjectID: projectID, + Rules: []ChannelRule{}, + TenantTags: []string{}, + GitReferenceRules: []string{}, + GitResourceRules: []ChannelGitResourceRule{}, + Resource: *resources.NewResource(), } }