diff options
author | puthuparambil.aditya <aditya.puthuparambil@bell.ca> | 2021-11-24 13:35:10 +0000 |
---|---|---|
committer | puthuparambil.aditya <aditya.puthuparambil@bell.ca> | 2021-12-02 13:48:29 +0000 |
commit | 5d8b24107ad579db89bcdad63476143f4a2db755 (patch) | |
tree | 9892587684f24f7559c1c93d61c173c875559693 /cps-rest/src/main/java/org/onap | |
parent | a84a4aa84fd22af9b89424d776a18a98d7515bd2 (diff) |
Adding examples in openapi for cps-core
1. Added examples for all parameters, request body and response body
2. Changed the response/request type to Object from String for all json objects
3. Passed json format data in all tests
4. PUT and PATCH operations at present return empty response, hence examples are changed to be in sync
Issue-ID: CPS-780
Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca>
Change-Id: If6dd5bb48df4e1bbf1026eaadf315df8f972e282
Diffstat (limited to 'cps-rest/src/main/java/org/onap')
-rwxr-xr-x | cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java index e57fb3c8c6..73c2c27c91 100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java @@ -49,11 +49,12 @@ public class DataRestController implements CpsDataApi { @Override public ResponseEntity<String> createNode(final String dataspaceName, final String anchorName, - final String jsonData, final String parentNodeXpath, final String observedTimestamp) { + final Object jsonData, final String parentNodeXpath, final String observedTimestamp) { if (isRootXpath(parentNodeXpath)) { - cpsDataService.saveData(dataspaceName, anchorName, jsonData, toOffsetDateTime(observedTimestamp)); + cpsDataService.saveData(dataspaceName, anchorName, jsonData.toString(), + toOffsetDateTime(observedTimestamp)); } else { - cpsDataService.saveData(dataspaceName, anchorName, parentNodeXpath, jsonData, + cpsDataService.saveData(dataspaceName, anchorName, parentNodeXpath, jsonData.toString(), toOffsetDateTime(observedTimestamp)); } return new ResponseEntity<>(HttpStatus.CREATED); @@ -61,7 +62,7 @@ public class DataRestController implements CpsDataApi { @Override public ResponseEntity<Void> deleteDataNode(final String dataspaceName, final String anchorName, - final String xpath, final String observedTimestamp) { + final String xpath, final String observedTimestamp) { cpsDataService.deleteDataNode(dataspaceName, anchorName, xpath, toOffsetDateTime(observedTimestamp)); return new ResponseEntity<>(HttpStatus.NO_CONTENT); @@ -69,8 +70,8 @@ public class DataRestController implements CpsDataApi { @Override public ResponseEntity<String> addListElements(final String parentNodeXpath, - final String dataspaceName, final String anchorName, final String jsonData, final String observedTimestamp) { - cpsDataService.saveListElements(dataspaceName, anchorName, parentNodeXpath, jsonData, + final String dataspaceName, final String anchorName, final Object jsonData, final String observedTimestamp) { + cpsDataService.saveListElements(dataspaceName, anchorName, parentNodeXpath, jsonData.toString(), toOffsetDateTime(observedTimestamp)); return new ResponseEntity<>(HttpStatus.CREATED); } @@ -87,25 +88,26 @@ public class DataRestController implements CpsDataApi { @Override public ResponseEntity<Object> updateNodeLeaves(final String dataspaceName, - final String anchorName, final String jsonData, final String parentNodeXpath, final String observedTimestamp) { - cpsDataService.updateNodeLeaves(dataspaceName, anchorName, parentNodeXpath, jsonData, + final String anchorName, final Object jsonData, final String parentNodeXpath, final String observedTimestamp) { + cpsDataService.updateNodeLeaves(dataspaceName, anchorName, parentNodeXpath, jsonData.toString(), toOffsetDateTime(observedTimestamp)); return new ResponseEntity<>(HttpStatus.OK); } @Override public ResponseEntity<Object> replaceNode(final String dataspaceName, final String anchorName, - final String jsonData, final String parentNodeXpath, final String observedTimestamp) { + final Object jsonData, final String parentNodeXpath, final String observedTimestamp) { cpsDataService - .replaceNodeTree(dataspaceName, anchorName, parentNodeXpath, jsonData, toOffsetDateTime(observedTimestamp)); + .replaceNodeTree(dataspaceName, anchorName, parentNodeXpath, jsonData.toString(), + toOffsetDateTime(observedTimestamp)); return new ResponseEntity<>(HttpStatus.OK); } @Override - public ResponseEntity<String> replaceListContent(final String parentNodeXpath, - final String dataspaceName, final String anchorName, final String jsonData, + public ResponseEntity<Object> replaceListContent(final String parentNodeXpath, + final String dataspaceName, final String anchorName, final Object jsonData, final String observedTimestamp) { - cpsDataService.replaceListContent(dataspaceName, anchorName, parentNodeXpath, jsonData, + cpsDataService.replaceListContent(dataspaceName, anchorName, parentNodeXpath, jsonData.toString(), toOffsetDateTime(observedTimestamp)); return new ResponseEntity<>(HttpStatus.OK); } |