Versions Compared

Key

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

...

Expand
titleScenario 2: Both the Data nodes are removed from existing data
Code Block
languagejson
[
  {
    "action": "remove",
    "xpath": "/xpath/to/parent-node",
    "source-data": {
      "data": "leaf data of parent-node"
    }
  },
  {
    "action": "remove",
    "xpath": "/xpath/to/child-node",
    "source-data": {
      "data": "leaf data of child node"
    }
  }
]
Expand
titleScenario 23: Both the Data nodes are updated
Code Block
[
  {
    "action": "replace",
    "xpath": "/xpath/to/parent-node",
    "source-data": {
      "data": "leaf data of parent-node before update"
    },
    "target-data": {
      "data": "leaf data of parent-node after update"
    }
  },
  {
    "action": "replace",
    "xpath": "/xpath/to/child-node",
    "source-data": {
      "data": "leaf data of child node before update"
    },
    "target-data": {
      "data": "leaf data of child node after update"
    }
  }
]

...

A separate algorithm would mean inconsistent results might be generated, hence careful planning and testing is to be planned alongside the development to ensure consistent results between the two options.

Proposed

...

changes to delta endpoints

  • GET-/v2/dataspaces/{dataspace-name}/anchors/{source-anchor-name}/delta?target-anchor-name={target-anchor-name}?xpath={xpath}&descendants={descendants}&group-by-nodes={true}

...

Parameter name

In

Required

Description

dataspace-name

Path

Yes

Dataspace name

anchor

Path

Yes

Anchor Name/Reference Anchor

xpath

Query

Yes

xpath of the node

group-by-nodes

Query

No

flag to enable/disable grouping of data nodes in delta report.

descendants

N/A

No

Level of descendants for delta comparison. Set to INCLUDE_ALL_DESCENDANTS by default.

Updated Delta Report format

After the proposed changes are implemented, the updated delta report will be concise and have the data nodes grouped as follows:

Expand
titleScenario 1: Both the data nodes are added to an existing data (create)
Code Block
languagejson
[
  {
    "action": "create",
    "xpath": "/xpath/to/parent-node",
    "target-data": [
      {
        "parent-data": "leaf data of parent-node",
        "child-data-node": [
          {
            "data": "leaf data of child node"
          }
        ]
      }
    ]
  }
]
Expand
titleScenario 2: Both the Data nodes are removed from existing data
Code Block
languagejson
[
  {
    "action": "remove",
    "xpath": "/xpath/to/parent-node",
    "source-data": [
      {
        "parent-data": "leaf data of parent-node",
        "child-data-node": [
          {
            "data": "leaf data of child node"
          }
        ]
      }
    ]
  }
]
Expand
titleScenario 3: Both the Data nodes are updated
Code Block
[
  {
    "action": "replace",
    "xpath": "/xpath/to/parent-node",
    "source-data": [
      {
        "parent-data": "old leaf data of parent-node",
        "child-data-node": [
          {
            "data": "old leaf data of child node"
          }
        ]
      }
    ],
    "target-data": [
      {
        "parent-data": "updated leaf data of parent-node",
        "child-data-node": [
          {
            "data": "updated leaf data of child node"
          }
        ]
      }
    ]
  }
]