You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 9
Next »
Objective : we want to include limit/depth/pagination in CPS-Core query APIs where output size is large. it will allow user to limit query outputs.
Implementation :
URL Changes | Comments |
---|
URL: http://<IP:PORT>/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/node?xpath=/&include-decendents=true&depth=1 | depth is an optional query parameter |
URL: http://<IP:PORT>/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query?cps-path=/&include-decendents=true&depth=1 | depth is an optional query parameter |
|
|
Code changes:
|
|
---|
cpsData.yml | nodeByDataspaceAndAnchor: get: description: Get a node with an option to retrieve all the children for a given anchor and dataspace tags: - cps-data summary: Get a node operationId: getNodeByDataspaceAndAnchor parameters: - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' - $ref: 'components.yml#/components/parameters/anchorNameInPath' - $ref: 'components.yml#/components/parameters/xpathInQuery' - $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery'
- $ref: 'components.yml#/components/parameters/depthInQuery' ... |
cpsQuery.yml | nodesByDataspaceAndAnchorAndCpsPath: get: description: Query data nodes for the given dataspace and anchor using CPS path tags: - cps-query summary: Query data nodes operationId: getNodesByDataspaceAndAnchorAndCpsPath parameters: - $ref: 'components.yml#/components/parameters/dataspaceNameInPath' - $ref: 'components.yml#/components/parameters/anchorNameInPath' - $ref: 'components.yml#/components/parameters/cpsPathInQuery' - $ref: 'components.yml#/components/parameters/includeDescendantsOptionInQuery' - $ref: 'components.yml#/components/parameters/depthInQuery' ... |
components.yml | depthInQuery: name: depth in: query description: depth parameter for large query outputs required: false schema: type: string default: all example: 1 |
FetchDescendantsOption.java | We Need to change this class to accept for any other depth values except -1, 0 and 1. |
CpsDataPersistenceServiceImpl.java | change in "queryDataNodes" method |