bdemers commented on issue #427: URL: https://github.com/apache/directory-scimple/issues/427#issuecomment-1846315481
Digging into the `REPLACE` vs `REMOVE`/`ADD` a bit more. I hacked up some (really ugly) code to try to understand how the logic in the `PatchGenerator` (previously `UpdateRequest`) works. As @kjthorpe18 mentioned in #411: https://github.com/apache/directory-scimple/pull/411#discussion_r1404579340 I think any time collections are diffed, changes should result in a remove/add (instead of a replace). I don't think it's possible to accurately make assumptions about when a replace could be used. We have a test that expects a `replace` when updating an email address. original: ```json "emails": [{ "type": "work", "value": "[email protected]"} ] ``` new: ```json "emails": [{ "type": "work", "value": "[email protected]"} ] ``` This could result in: ``` type: REPLACE path: emails[type EQ "work"].value value: [email protected] ``` Or this: ``` type: REMOVE path: emails[value EQ "[email protected]"] type: ADD path: emails value: { "type": "work", "value": "[email protected]"} ``` I think it's _safer_ to assume the latter. > **NOTE:** Generating patches is not the same as applying patches, which does need to support both REMOVE/ADD and REPLACE operations. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
