From 4bdbd302a1fd7e9e13d266998921ecf7c8a2605a Mon Sep 17 00:00:00 2001 From: Alejandro Olivares Date: Thu, 5 Feb 2026 11:48:53 +0100 Subject: [PATCH 1/4] Extend TestSCIMEnterpriseAttribute_Marshal() for new case --- github/enterprise_scim_test.go | 40 ++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/github/enterprise_scim_test.go b/github/enterprise_scim_test.go index 1ffe24e75fd..e885e9e0ecb 100644 --- a/github/enterprise_scim_test.go +++ b/github/enterprise_scim_test.go @@ -260,27 +260,43 @@ func TestSCIMEnterpriseAttribute_Marshal(t *testing.T) { u := &SCIMEnterpriseAttribute{ Schemas: []string{"s"}, Operations: []*SCIMEnterpriseAttributeOperation{ + {Op: "o1"}, { - Op: "o1", - Path: Ptr("p1"), - Value: Ptr("v1"), + Op: "o2", + Path: Ptr("p2"), + Value: Ptr("v2"), }, { - Op: "o2", + Op: "add", + Path: Ptr("members"), + Value: Ptr(`"value":[{"value":"v-1"},{"value":"v-2"}]`), }, }, } want := `{ "schemas": ["s"], - "Operations": [{ - "op": "o1", - "path": "p1", - "value": "v1" - }, - { - "op": "o2" - }] + "Operations": [ + {"op": "o1"}, + { + "op": "o2", + "path": "p2", + "value": "v2" + }, + { + "op": "replace", + "path": "emails[type eq 'work'].value", + "value": "v@3.com" + }, + { + "op":"add", + "path":"members", + "value":[ + {"value":"abc-123"}, + {"value":"def-456"} + ] + } + ] }` testJSONMarshal(t, u, want) From a80f4b8d499ec7346ac3462714b9bcd56892ad45 Mon Sep 17 00:00:00 2001 From: Alejandro Olivares Date: Thu, 5 Feb 2026 13:09:37 +0100 Subject: [PATCH 2/4] Change Value type to `any` --- github/enterprise_scim.go | 2 +- github/enterprise_scim_test.go | 30 ++++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/github/enterprise_scim.go b/github/enterprise_scim.go index ea45b2e5c86..9f9e296944c 100644 --- a/github/enterprise_scim.go +++ b/github/enterprise_scim.go @@ -165,7 +165,7 @@ type SCIMEnterpriseAttribute struct { type SCIMEnterpriseAttributeOperation struct { Op string `json:"op"` // Can be one of: `add`, `replace`, `remove`. Path *string `json:"path,omitempty"` // Path to the attribute being modified (Filters are not supported). - Value *string `json:"value,omitempty"` // New value for the attribute being modified. + Value any `json:"value,omitempty"` // New value for the attribute being modified. } // ListProvisionedSCIMGroups lists provisioned SCIM groups in an enterprise. diff --git a/github/enterprise_scim_test.go b/github/enterprise_scim_test.go index e885e9e0ecb..8855f828225 100644 --- a/github/enterprise_scim_test.go +++ b/github/enterprise_scim_test.go @@ -264,12 +264,15 @@ func TestSCIMEnterpriseAttribute_Marshal(t *testing.T) { { Op: "o2", Path: Ptr("p2"), - Value: Ptr("v2"), + Value: "v2", }, { - Op: "add", - Path: Ptr("members"), - Value: Ptr(`"value":[{"value":"v-1"},{"value":"v-2"}]`), + Op: "add", + Path: Ptr("members"), + Value: []*SCIMEnterpriseDisplayReference{ + {Value: "v-1"}, + {Value: "v-2"}, + }, }, }, } @@ -284,16 +287,15 @@ func TestSCIMEnterpriseAttribute_Marshal(t *testing.T) { "value": "v2" }, { - "op": "replace", - "path": "emails[type eq 'work'].value", - "value": "v@3.com" - }, - { - "op":"add", - "path":"members", - "value":[ - {"value":"abc-123"}, - {"value":"def-456"} + "op": "add", + "path": "members", + "value": [ + { + "value": "v-1" + }, + { + "value": "v-2" + } ] } ] From 65f9a9ffef0fdfb1ede3d56538a4a54dbfee1d7f Mon Sep 17 00:00:00 2001 From: Alejandro Olivares Date: Thu, 5 Feb 2026 13:18:09 +0100 Subject: [PATCH 3/4] Update types, run generate --- github/github-accessors.go | 8 -------- github/github-accessors_test.go | 11 ----------- 2 files changed, 19 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 5190e65693b..4f2f4af4082 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -26878,14 +26878,6 @@ func (s *SCIMEnterpriseAttributeOperation) GetPath() string { return *s.Path } -// GetValue returns the Value field if it's non-nil, zero value otherwise. -func (s *SCIMEnterpriseAttributeOperation) GetValue() string { - if s == nil || s.Value == nil { - return "" - } - return *s.Value -} - // GetDisplay returns the Display field if it's non-nil, zero value otherwise. func (s *SCIMEnterpriseDisplayReference) GetDisplay() string { if s == nil || s.Display == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 944be5e9ce6..f4511ed5eab 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -34676,17 +34676,6 @@ func TestSCIMEnterpriseAttributeOperation_GetPath(tt *testing.T) { s.GetPath() } -func TestSCIMEnterpriseAttributeOperation_GetValue(tt *testing.T) { - tt.Parallel() - var zeroValue string - s := &SCIMEnterpriseAttributeOperation{Value: &zeroValue} - s.GetValue() - s = &SCIMEnterpriseAttributeOperation{} - s.GetValue() - s = nil - s.GetValue() -} - func TestSCIMEnterpriseDisplayReference_GetDisplay(tt *testing.T) { tt.Parallel() var zeroValue string From 3f6ba6f53b5cff7f19fcc08f61264498752283f4 Mon Sep 17 00:00:00 2001 From: Alejandro Olivares Date: Thu, 5 Feb 2026 13:27:30 +0100 Subject: [PATCH 4/4] Add test for special characters --- github/enterprise_scim_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/github/enterprise_scim_test.go b/github/enterprise_scim_test.go index 8855f828225..c4f219744dd 100644 --- a/github/enterprise_scim_test.go +++ b/github/enterprise_scim_test.go @@ -266,6 +266,11 @@ func TestSCIMEnterpriseAttribute_Marshal(t *testing.T) { Path: Ptr("p2"), Value: "v2", }, + { + Op: "replace", + Path: Ptr("emails[type eq 'work'].value"), + Value: "v@3.com", + }, { Op: "add", Path: Ptr("members"), @@ -286,6 +291,11 @@ func TestSCIMEnterpriseAttribute_Marshal(t *testing.T) { "path": "p2", "value": "v2" }, + { + "op": "replace", + "path": "emails[type eq 'work'].value", + "value": "v@3.com" + }, { "op": "add", "path": "members",