Versions Compared

Key

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

...

The current limitation of only one data tree(single top level data node) being supported by CPS does not seems to be justifiable. The goal of this study is to find out what is the cause of the above error and bring in support for JSON data with multiple top level nodes.

Problem Statement

Possible SolutionsSub-TasksNotes/CommentsPros/Cons

Add support for JSON data with multiple top level nodes. Refer:

Jira
serverONAP Jira
serverId425b2b0a-557c-3c0c-b515-579789cceedb
keyCPS-341

Identify the top-level data nodes in the JSON and then iterate over them and store them individually one by one in using Create node endpoint
  • Gson might have support for this, Need more research on it
  • CPS team preferred Jackson over gson

Pros: 

No changes to current payload

Cons:

  • The approach is complex compared to using JSON array as payload, need to write logic to parse over multiple data tree and this might require additional libraries as well.
  • Get operation needs to be updated accordingly, currently it returns only the first data tree even if multiple data trees exist under same anchor
Use JSON array and store the JSON array in CPS DB using Create node endpoint 
  • need to define new payload
  • The payload needs to be changed. Will add the payload format soon.
  • Need to identify which endpoints might get effected with this change

Pros:

Minimal code change (approach will require us to iterate over multiple data trees passed as JSON array)

Cons:

  • Payload will change, so need to decide how to store data in DB 
  • Need to update get operation as well to retrieve multiple data trees
  •  cps-query already returns JSON array and might be impacted.