-
Bug
-
Resolution: Done
-
Medium
-
Jakarta Release
-
None
PATCH API is currently working as PUT API removing all the other leaves in the xpath when trying to modify single value.
PATCH API should modify only the values present in the request body and not remove/delete existing values.
Steps to reproduce:
1. Data space name : E2EDemo*
curl --location --user cpsuser:cpsr0cks! -H "Accept: application/json" -H "Content-Type: application/json" --request POST 'http://localhost:8883/cps/api/v1/dataspaces?dataspace-name=E2EDemo'
2. schema set: ran-network*
curl --location --user cpsuser:cpsr0cks! --request POST 'http://localhost:8883/cps/api/v1/dataspaces/E2EDemo/schema-sets' --form 'file=@"ran-network.zip"' --form 'schema-set-name="ran-network"'
3. anchor name: ran-network-anchor*
curl --location --user cpsuser:cpsr0cks! --request POST 'http://localhost:8883/cps/api/v1/dataspaces/E2EDemo/anchors?schema-set-name=ran-network&anchor-name=ran-network-anchor'
4. Initial data*
curl -H "Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=" --request PUT 'http://localhost:8883/cps/api/v1/dataspaces/E2EDemo/anchors/ran-network-anchor/nodes' \
--header 'Content-Type: application/json' -d @ran-network-data.txt
5. API Tried*
I want to modify only 'near-rt-ric-url' leaf in 'attributes' container, but the below patch request is removing 'trackingArea' and 'rANNFNSSIList'
curl -H "Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=" --header 'Content-Type: application/json' --request PATCH 'http://localhost:8883/cps/api/v1/dataspaces/E2EDemo/anchors/ran-network-anchor/nodes?xpath=/ran-network/NearRTRIC[@idNearRTRIC='11']' -d '{"attributes":{"near-rt-ric-url":"10.165.160.77:6070"}}' -ig
6. Expected Response
curl -H "Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=" --request GET 'http://localhost:8883/cps/api/v1/dataspaces/E2EDemo/anchors/ran-network-anchor/node?xpath=/ran-network/NearRTRIC[@idNearRTRIC='11']/attributes' -ig
HTTP/1.1 200 OK
Date: Thu, 05 Jan 2023 12:40:04 GMT
Set-Cookie: JSESSIONID=node01tmxe8cvqjx8d1tyjhoz62wuo323.node0; Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
Transfer-Encoding: chunked
{"rn:attributes":"trackingArea":"Kingston","rANNFNSSIList":["e893-e93r-c0f2-kj76","m93ed-e93e-c0f2-9i7y"],"near-rt-ric-url":"10.165.160.77:6070"
7. Actual Response
curl -H "Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=" --request GET 'http://localhost:8883/cps/api/v1/dataspaces/E2EDemo/anchors/ran-network-anchor/node?xpath=/ran-network/NearRTRIC[@idNearRTRIC='11']/attributes' -ig
HTTP/1.1 200 OK
Date: Thu, 05 Jan 2023 12:45:22 GMT
Set-Cookie: JSESSIONID=node01felu9cmh36fcvnaejzl2m09a29.node0; Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
Transfer-Encoding: chunked
{"rn:attributes":
{"near-rt-ric-url":"10.165.160.77:6070"}}
- clones
-
CPS-1006 Extend CPS PATCH API to allow update of leaves for multiple data nodes
- Closed