Objective Background : 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.
It was discussed on 11th Nov 2022 in weekly meeting to use 'depth' parameter to limit large outputs.
Implementation :
'depth' query parameter added in below URLs | Notes | Decision |
---|
URL: http://<IP:PORT>/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/node?xpath=/&include- |
descendants=true&depth=1 |
|
| |
URL: http://<IP:PORT>/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/nodes/query?cps-path=/&include- |
descendents=true&depth=1 |
...
Implementations:
changes files | changes/notes | Decision |
---|---|---|
cpsData.yml | nodeByDataspaceAndAnchor: |
|
|
|
|
tags:
- cps-data
summary: Get a node
operationId: getNodeByDataspaceAndAnchor
parameters:
- $ref: 'components
. |
- $ref: 'components
. |
- $ref: 'components
. |
- $ref: 'components.yml#/components/parameters/ |
- $ref: 'components.yml#/components/parameters/
depthInQuery' | |
cpsQuery.yml | nodesByDataspaceAndAnchorAndCpsPath: |
description: Query data nodes for the given dataspace and anchor using CPS path
tags
: |
|
|
summary: Query data nodes
operationId: getNodesByDataspaceAndAnchorAndCpsPath
parameters:
- $ref: 'components.yml#/components/parameters/dataspaceNameInPath'
- $ref: 'components
. |
- $ref: 'components
. |
- $ref: 'components
. |
| ||
components.yml | depthInQuery: | |
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 |