Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions github/enterprise_properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestEnterpriseService_GetAllCustomProperties(t *testing.T) {
PropertyName: Ptr("name"),
ValueType: "single_select",
Required: Ptr(true),
DefaultValue: Ptr("production"),
DefaultValue: "production",
Description: Ptr("Prod or dev environment"),
AllowedValues: []string{"production", "development"},
ValuesEditableBy: Ptr("org_actors"),
Expand Down Expand Up @@ -179,7 +179,7 @@ func TestEnterpriseService_GetCustomProperty(t *testing.T) {
PropertyName: Ptr("name"),
ValueType: "single_select",
Required: Ptr(true),
DefaultValue: Ptr("production"),
DefaultValue: "production",
Description: Ptr("Prod or dev environment"),
AllowedValues: []string{"production", "development"},
ValuesEditableBy: Ptr("org_actors"),
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestEnterpriseService_CreateOrUpdateCustomProperty(t *testing.T) {
property, _, err := client.Enterprise.CreateOrUpdateCustomProperty(ctx, "e", "name", &CustomProperty{
ValueType: "single_select",
Required: Ptr(true),
DefaultValue: Ptr("production"),
DefaultValue: "production",
Description: Ptr("Prod or dev environment"),
AllowedValues: []string{"production", "development"},
ValuesEditableBy: Ptr("org_actors"),
Expand All @@ -236,7 +236,7 @@ func TestEnterpriseService_CreateOrUpdateCustomProperty(t *testing.T) {
PropertyName: Ptr("name"),
ValueType: "single_select",
Required: Ptr(true),
DefaultValue: Ptr("production"),
DefaultValue: "production",
Description: Ptr("Prod or dev environment"),
AllowedValues: []string{"production", "development"},
ValuesEditableBy: Ptr("org_actors"),
Expand Down
2 changes: 1 addition & 1 deletion github/event_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13735,7 +13735,7 @@ func TestCustomPropertyEvent_Marshal(t *testing.T) {
ValueType: "single_select",
SourceType: Ptr("enterprise"),
Required: Ptr(true),
DefaultValue: Ptr("production"),
DefaultValue: "production",
Description: Ptr("Prod or dev environment"),
AllowedValues: []string{"production", "development"},
ValuesEditableBy: Ptr("org_actors"),
Expand Down
8 changes: 0 additions & 8 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions github/orgs_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ type CustomProperty struct {
ValueType string `json:"value_type"`
// Whether the property is required.
Required *bool `json:"required,omitempty"`
// Default value of the property.
DefaultValue *string `json:"default_value,omitempty"`
// Default value of the property. Can be null, string or array of strings.
DefaultValue any `json:"default_value,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zyfy29 - for the a null to be passed through to the backend, we need to remove the omitempty.
Also, please make sure that there is a unit test where the value is nil (unassigned) so we demonstrate that the null is passed through to the backend.

Suggested change
DefaultValue any `json:"default_value,omitempty"`
DefaultValue any `json:"default_value"`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks!

// Short description of the property.
Description *string `json:"description,omitempty"`
// An ordered list of the allowed values of the property. The property can have up to 200
Expand Down
18 changes: 14 additions & 4 deletions github/orgs_properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func TestOrganizationsService_GetAllCustomProperties(t *testing.T) {
"property_name": "team",
"value_type": "string",
"description": "Team owning the repository"
},
{
"property_name": "multi_select_property",
"value_type": "multi_select",
"default_value": ["production", "development"]
}
]`)
})
Expand All @@ -56,7 +61,7 @@ func TestOrganizationsService_GetAllCustomProperties(t *testing.T) {
PropertyName: Ptr("name"),
ValueType: "single_select",
Required: Ptr(true),
DefaultValue: Ptr("production"),
DefaultValue: "production",
Description: Ptr("Prod or dev environment"),
AllowedValues: []string{"production", "development"},
ValuesEditableBy: Ptr("org_actors"),
Expand All @@ -70,6 +75,11 @@ func TestOrganizationsService_GetAllCustomProperties(t *testing.T) {
ValueType: "string",
Description: Ptr("Team owning the repository"),
},
{
PropertyName: Ptr("multi_select_property"),
ValueType: "multi_select",
DefaultValue: []any{"production", "development"},
},
}
if !cmp.Equal(properties, want) {
t.Errorf("Organizations.GetAllCustomProperties returned %+v, want %+v", properties, want)
Expand Down Expand Up @@ -179,7 +189,7 @@ func TestOrganizationsService_GetCustomProperty(t *testing.T) {
PropertyName: Ptr("name"),
ValueType: "single_select",
Required: Ptr(true),
DefaultValue: Ptr("production"),
DefaultValue: "production",
Description: Ptr("Prod or dev environment"),
AllowedValues: []string{"production", "development"},
ValuesEditableBy: Ptr("org_actors"),
Expand Down Expand Up @@ -223,7 +233,7 @@ func TestOrganizationsService_CreateOrUpdateCustomProperty(t *testing.T) {
property, _, err := client.Organizations.CreateOrUpdateCustomProperty(ctx, "o", "name", &CustomProperty{
ValueType: "single_select",
Required: Ptr(true),
DefaultValue: Ptr("production"),
DefaultValue: "production",
Description: Ptr("Prod or dev environment"),
AllowedValues: []string{"production", "development"},
ValuesEditableBy: Ptr("org_actors"),
Expand All @@ -236,7 +246,7 @@ func TestOrganizationsService_CreateOrUpdateCustomProperty(t *testing.T) {
PropertyName: Ptr("name"),
ValueType: "single_select",
Required: Ptr(true),
DefaultValue: Ptr("production"),
DefaultValue: "production",
Description: Ptr("Prod or dev environment"),
AllowedValues: []string{"production", "development"},
ValuesEditableBy: Ptr("org_actors"),
Expand Down
Loading