Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

CPS core would want the container name on the highest parent level of the JSON output and as such have to distinguish between a parent level node and non parent level node. They plan to create an outer map to wrap the inner map which creates the appropriate levels in the JSON output. 

Refer CPS-461 Align DataNode for Get and Post/Put endpoints in CPS Core for more details


Response for getDataNode root node now:

{
   "bookstore-name":"Chapters",
   "categories":[ ... ]
}

Response after:

{
   "bookstore":{
     "bookstore-name":"Chapters",
      "categories":[ ... ]
  }
}

Existing template:

curl --location --request POST 'http://localhost:8080/templates' --header 'Content-Type: application/json' --data-raw '{
       "templateId": "get-bookstore",
       "model": "dynamic",
       "requestType": "get",
       "xpathTemplate": "/",
       "includeDescendants": true

   }' -i

Result of template execution:

{
   "bookstore":{
     "bookstore-name":"Chapters",
      "categories":[ ... ]
  }
}

Changes to the template:


curl --location --request POST 'http://localhost:8080/templates' --header 'Content-Type: application/json' --data-raw '{
       "templateId": "get-bookstore",
       "model": "dynamic",
       "requestType": "get",
       "xpathTemplate": "/",
       "includeDescendants": true,

        "transformParam":"bookstore
   }' -i


Including 'transformParam' in the template would apply transformation to the output by removing 'bookstore' from the json output and returning the below response:

{
   "bookstore-name":"Chapters",
   "categories":[ ... ]
}


Refer R9 TBDMT Enhancements - Developer Wiki - Confluence (onap.org) for more details and examples.



TO DO:

Check for all get and query requests if template update is enough or code change/bug fix is required.


  • No labels