Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-5705

Removal of multiple elements of an array in a single patch set produces incorrect results

    Details

      Description

      Consider a managed/user with a list of favorite ice cream flavors:

      curl -u openidm-admin:openidm-admin -X PUT -k https://localhost:8443/openidm/managed/user/jfeasel -H 'Content-type: application/json' --data '{"userName": "jfeasel", "givenName": "Jake", "sn": "Feasel", "mail": "jfeasel@example.com", "favorites": ["vanilla","chocolate","strawberry","mint"]}'
      

      User decides they no longer like chocolate (position 1) and strawberry (position 2):

      curl -u openidm-admin:openidm-admin -X PATCH -k https://localhost:8443/openidm/managed/user/jfeasel -H 'Content-type: application/json' --data '[{"operation": "remove", "field": "/favorites/1"}, {"operation":"remove","field":"/favorites/2"}]'
      

      Result for "favorites" should be : ["vanilla","mint"] but instead is ["vanilla","strawberry"].

      This indicates that as the patch set is processed, the items in the set are shifted over; this causes the indexes for subsequent patch operations to be incorrect.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                joy.feng Joy Feng [X] (Inactive)
                Reporter:
                jake.feasel Jake Feasel
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: