eclipse-emfcloud / emfcloud-modelserver

Modelserver component
Other
40 stars 21 forks source link

JSON Patch: Object not added at index specified in add op #240

Closed cdamus closed 1 year ago

cdamus commented 1 year ago

Given an add operation that inserts a new object at some index of a containment reference, the new object is always appended to the containment list. The index is ignored.

e.g., given

{
  "op": "add",
  "path": "/eClassifiers/3/eStructuralFeatures/2",
  "value": {
    "$type": "http://www.eclipse.org/.../EAttribute",
    "name": "newAttribute"
  }
}

the correct EClass is located in the classifiers list of the package, but if there are more than two features already in that class, the new attribute is always added at the end of the list of features, not inserted at index 2.