-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
I fear there's a bug with the type of Value in:
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.
}For example, this code fails with a Bad request:
...
addingMembers := github.SCIMEnterpriseAttribute{
Operations: []*github.SCIMEnterpriseAttributeOperation{{
Op: "add",
Path: github.Ptr("members"),
Value: github.Ptr(`[{"value":"1234abcd-1234-abcd-0004-123456789abcd"}]`),
}},
Schemas: []string{github.SCIMSchemasURINamespacesPatchOp},
}
group, resp, err := gh.Enterprise.UpdateSCIMGroupAttribute(ctx, "myenterprise", gId, addingMembers)
if err != nil {
attributeJson, _ := json.Marshal(addingMembers)
return nil, fmt.Errorf("attribute:%v failed with %v: %w", string(attributeJson), resp.Status, err)
}
...OUTPUT:
level=ERROR msg="Update failed" err="attribute:{\"schemas\":[\"urn:ietf:params:scim:api:messages:2.0:PatchOp\"],\"Operations\":[{\"op\":\"add\",\"path\":\"members\",\"value\":\"[{\\\"value\\\":\\\"1234abcd-1234-abcd-0004-123456789abcd\\\"}]\"}]} failed: 400 Bad Request: PATCH https://api.github.com/scim/v2/enterprises/myenterprise/Groups/1235abcd-1234-abcd-0004-123456789abcd5: 400 []"
exit status 1
The final JSON looks malformed, too many scaped quotes (\").
ℹ️ I'd like to work in the solution
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels