Skip to content

Commit

Permalink
fix: Make project AllowIgnoreChannelRules property optional (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
geofflamrock authored Jul 16, 2024
1 parent 950eb2f commit fd9f29d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/projects/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

type Project struct {
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules"`
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules,omitempty"`
AutoCreateRelease bool `json:"AutoCreateRelease"`
AutoDeployReleaseOverrides []AutoDeployReleaseOverride `json:"AutoDeployReleaseOverrides,omitempty"`
ClonedFromProjectID string `json:"ClonedFromProjectId,omitempty"`
Expand Down Expand Up @@ -72,7 +72,7 @@ func NewProject(name string, lifecycleID string, projectGroupID string) *Project
// UnmarshalJSON sets this project to its representation in JSON.
func (p *Project) UnmarshalJSON(data []byte) error {
var fields struct {
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules"`
AllowIgnoreChannelRules bool `json:"AllowIgnoreChannelRules,omitempty"`
AutoCreateRelease bool `json:"AutoCreateRelease"`
AutoDeployReleaseOverrides []AutoDeployReleaseOverride `json:"AutoDeployReleaseOverrides,omitempty"`
ClonedFromProjectID string `json:"ClonedFromProjectId,omitempty"`
Expand Down
1 change: 0 additions & 1 deletion pkg/projects/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func TestProjectExtensionSettingsAsJSON(t *testing.T) {
standardChangeTemplateName := internal.GetRandomName()

expectedJSON := fmt.Sprintf(`{
"AllowIgnoreChannelRules": false,
"AutoCreateRelease": false,
"DefaultToSkipIfAlreadyInstalled": false,
"ExtensionSettings": [
Expand Down
6 changes: 2 additions & 4 deletions test/resources/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ func TestProjectMarshalJSON(t *testing.T) {
"IsDisabled": false,
"DiscreteChannelRelease": false,
"IsVersionControlled": false,
"ProjectConnectivityPolicy":{"AllowDeploymentsToNoTargets":false,"ExcludeUnhealthyTargets":false},
"AllowIgnoreChannelRules": false
"ProjectConnectivityPolicy":{"AllowDeploymentsToNoTargets":false,"ExcludeUnhealthyTargets":false}
}`, lifecycleID, name, projectGroupID)

project := projects.NewProject(name, lifecycleID, projectGroupID)
Expand Down Expand Up @@ -69,8 +68,7 @@ func TestProjectMarshalJSON(t *testing.T) {
"DefaultToSkipIfAlreadyInstalled": false,
"IsDisabled": false,
"DiscreteChannelRelease": false,
"IsVersionControlled": false,
"AllowIgnoreChannelRules": false
"IsVersionControlled": false
}`, lifecycleID, name, connectivityPolicyAsJSON, projectGroupID)

jsonassert.New(t).Assertf(string(projectAsJSON), expectedJson)
Expand Down

0 comments on commit fd9f29d

Please sign in to comment.