Skip to content

fix!: Change SCIMEnterpriseAttributeOperation.Value from *string to any#3971

Open
elminster-aom wants to merge 4 commits intogoogle:masterfrom
elminster-aom:fix_SCIMEnterpriseAttributeOperation
Open

fix!: Change SCIMEnterpriseAttributeOperation.Value from *string to any#3971
elminster-aom wants to merge 4 commits intogoogle:masterfrom
elminster-aom:fix_SCIMEnterpriseAttributeOperation

Conversation

@elminster-aom
Copy link
Contributor

@elminster-aom elminster-aom commented Feb 5, 2026

BREAKING CHANGE: SCIMEnterpriseAttributeOperation.Value is changed from *string to any.

Fixes: #3968.

From GitHub.com docs endpoint Update an attribute for a SCIM enterprise group, there are two request examples where the data for a POST request is:

  1. Update Group:
    {
      "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
      "Operations": [
        {
          "op": "replace",
          "path": "displayName",
          "value": "Employees"
        }
      ]
    }
  2. Add members:
    {
      "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
      "Operations": [
        {
          "op": "add",
          "path": "members",
          "value": [
            {"value":"879db59-3bdf-4490-ad68-ab880a2694745"},
            {"value":"0db508eb-91e2-46e4-809c-30dcbda0c685"}
          ]
        }
      ]
    }

Similar situation for the other endpoint, Update an attribute for a SCIM enterprise user:

  1. Update users with a multi-valued property:
    {
      "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
      "Operations": [
        {
          "op": "replace",
          "path": "emails[type eq 'work'].value",
          "value": "updatedEmail@microsoft.com"
        },
        {
          "op": "replace",
          "path": "name.familyName",
          "value": "updatedFamilyName"
        }
      ]
    }
  2. Single valued property:
    {
      "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
      "Operations": [
        {
          "op": "replace",
          "path": "userName",
          "value": "5b50642d-79fc-4410-9e90-4c077cdd1a59@testuser.com"
        },
        {
          "op": "replace",
          "path": "displayName",
          "value": "Monalisa Octocat"
        }
      ]
    }
  3. Disable user:
    {
      "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
      "Operations": [
        {
          "op": "replace",
          "path": "active",
          "value": false
        }
      ]
    }

@elminster-aom elminster-aom force-pushed the fix_SCIMEnterpriseAttributeOperation branch from ea7692f to 4bdbd30 Compare February 5, 2026 11:29
@elminster-aom
Copy link
Contributor Author

elminster-aom commented Feb 5, 2026

Taking as reference this code:

// CustomPropertyValue represents a custom property value.
type CustomPropertyValue struct {
PropertyName string `json:"property_name"`
Value any `json:"value"`
}

Change the type of SCIMEnterpriseAttributeOperation.Value to any but it doesn't work as expected:

go test -test.fullpath=true -timeout 30s -run ^TestSCIMEnterpriseAttribute_Marshal$ github.com/google/go-github/v82/github

# github.com/google/go-github/v82/github [github.com/google/go-github/v82/github.test]
/home/aleoliva/gitRepo/go-github/github/github-accessors.go:26886:10: invalid operation: cannot indirect s.Value (variable of interface type any)
FAIL	github.com/google/go-github/v82/github [build failed]
FAIL

UPDATE: Solved after running script/generate.sh

@elminster-aom elminster-aom marked this pull request as ready for review February 5, 2026 12:28
@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.50%. Comparing base (5d70283) to head (3f6ba6f).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3971   +/-   ##
=======================================
  Coverage   93.50%   93.50%           
=======================================
  Files         206      206           
  Lines       17550    17550           
=======================================
  Hits        16411    16411           
  Misses        938      938           
  Partials      201      201           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis changed the title Extend TestSCIMEnterpriseAttribute_Marshal() for new case fix!: Change SCIMEnterpriseAttributeOperation.Value from *string to any Feb 6, 2026
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Feb 6, 2026
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @elminster-aom!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @zyfy29 - @Not-Dhananjay-Mishra

Op: "o2",
Op: "replace",
Path: Ptr("emails[type eq 'work'].value"),
Value: "v@3.com",
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to remain consistent with rest of repo.

Suggested change
Value: "v@3.com",
Value: "v@example.com",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Method UpdateSCIMGroupAttribute() fails with Bad request (400) when adding/removing members

3 participants