Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

#

Issue

Notes 

Decision

1Add or Delete leaves handle as UPDATE or ADD/DELETE?

The delta report proposed follows the Json Patch format of representing the differences between 2 JSON data. Apart from this the delta is dependent on individual data nodes of the JSON data, this is because the delta report will contain the action, xpath and the source/target data. And since the xpaths are unique to data nodes and not leaf data, every delta entity in delta report will be between 2 data nodes. Going by the general convention and referring RFC-6902:

  • AddCreate: If a data node exists only in the target location (target anchor or JSON payload) then it will be considered an ADD a 'create' action and all the leaf data under this data node and the child data nodes of the aforementioned data node will be considered as newly added data.
    • The child data nodes will be reported separately in the delta report because these data nodes can be individually identified with their unique xpaths.
  • Remove: If a data node exists only in the source location (source anchor) but is not in the target location (target anchor or JSON payload) then this will be considered as a REMOVE 'remove' operation. All the leaf data under this data node and the child data nodes of the aforementioned data node will be considered as removed.
    • The child data nodes will be reported separately in the delta report because these data nodes can be individually identified with their unique xpaths.
  • UpdateReplace: If a data node exists both, in the source and target location then the individual leaf nodes of this data node are compared to find any changes in the data. If the data is changed then it is reported as an UPDATE a 'replace' action because leaf data of an already existing data node are updated here.
    • only the leaves which are added, deleted or modified are reported in delta report. Any unmodified leaf is not reported.
    • Child data nodes are evaluated individually, if a child node is added it's an ADD a 'create' action, if a child node is removed its REMOVE 'remove' action and if a child node exists in both locations, then the leaves are evaluated for any changes which are reported as UPDATE 'replace' action.
Updated as per notes.
2How to handle multiple changes at different levels?
Since the delta report will contain the xpaths of data nodes changed, so for changes at multiple levels i.e., parent and child data nodes, the approach will be to handle each data node individually and report them in the delta report. 

3More scenarios need to be explored and documented in detail. Such as handling arrays within a json, handling child/grandchild changes.
scenarios such as data nodes at multiple levels, arrays and lists are covered.

...

Code Block
titleResponse body should contain anchors delta report (added/deleted/modified configuration) as below.
collapsetrue
[
  {
    "action": "ADDcreate",
    "xpath": "/bookstore/categories/[@code=3]",
    "target-data": {
      "code": 3,
      "name": "kidz"
    }
  },
  {
    "action": "REMOVEremove",
    "xpath": "/bookstore/categories/[@code=1]",
    "source-data": {
      "code": 1,
      "name": "Fiction"
    }
  },
  {
    "action": "UPDATEreplace",
    "xpath": "/bookstore/categories/[@code=2]",
    "source-data": {
      "name": "Funny"
    },
    "target-data": {
      "name": "Comic"
    }
  }
]

...

Code Block
titleDelta Report Format for CPS
collapsetrue
[
  {
    "action": "ADDcreate",
    "xpath": "/bookstore/categories/[@code=3]",
    "target-data": {
      "code": "3,",
      "name": "kidz"
    }
  },
  {
    "action": "REMOVEremove",
    "xpath": "/bookstore/categories/[@code=1]",
    "source-data": {
      "code": "1,",
      "name": "Fiction"
    }
  },
  {
    "action": "UPDATEreplace",
    "xpath": "/bookstore/categories/[@code=2]",
    "source-data": {
      "name": "Funny"
    },
    "target-data": {
      "name": "Comic"
    }
  }
]

...