Versions Compared

Key

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

...

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 endpointMake a separate PoC where we parse JSON data individually
  • Gson might have support for this, Need more research on it
  • CPS team preferred Jackson over gson

Pros: 

  • No changes to current payload
  • No need to write new API, existing API will serve the purpose
  • Backwards compatible

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. New Get Data node API is needed
Use JSON array and store the JSON array in CPS DB using Create node endpoint 
  • need to define new payload

Sample:

Code Block
[{...},{...},{...}]


  • The payload needs to be changed. Will add the payload format soon.
  • Need to identify which endpoints might get effected with this change
  • Can convert the JSON object payload to an Array internally when single object is passed

Pros:

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

Cons:

  • New endpoint need to be added. Need to decide on endpoint because current Post API uses "nodes".
  • New test cases need to be added
  • Need to update get operation as well to retrieve multiple data trees, so new endpoint is needed
  • Need to test existing GET nodes API in depth.

...