Skip to content

REPLACE with a filter doesn't behave as expected #201

@joel-mason

Description

@joel-mason

Given a User with an emails payload of:

"emails": [
    {
      "value": "[email protected]",
      "type": "work",
      "primary": true
    },
    {
      "value": "[email protected]",
      "type": "home"
    },
    {
      "value": "[email protected]",
      "type": "private"
    },
    {
      "value": "[email protected]"
    }
  ],

When patching with the following request

{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "path": "emails[value eq \"[email protected]\"]",
      "op": "replace",
      "value": "{\n  \"type\" : \"business\",\n  \"primary\" : false,\n  \"display\" : \"testEmail\",\n  \"value\" : \"[email protected]\",\n  \"$ref\" : \"ref\"\n}"
    }
  ]
}

I expect the outcome to be

"emails": [
    {
      "value": "[email protected]",
      "type": "business",
      "display": "testEmail",
      "primary": true
    },
    {
      "value": "[email protected]",
      "type": "home"
    },
    {
      "value": "[email protected]",
      "type": "private"
    },
    {
      "value": "[email protected]"
    }
  ],

But the actual outcome is

"emails": [
    {
      "value": "[email protected]",
      "type": "business",
      "primary": false
    }
  ],

According to the wiki, it says that this should only update matching nodes from the filter https://github.com/Captain-P-Goldfish/SCIM-SDK/wiki/Patching-resources#add-3

When using add with the same filter, a new item is just added to the array, they aren't "merged" together

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions