eclipse-basyx / basyx-java-server-sdk

MIT License
55 stars 45 forks source link

[BUG] Updating ValueOnly on a Submodel directly is not working #408

Open FelixMethe opened 3 weeks ago

FelixMethe commented 3 weeks ago

Describe the bug Trying to update a submodels valueOnly directly, returns a Failed to read request.

To Reproduce Steps to reproduce the behavior:

Let's say I have a Submodel:

curl --request POST \
  --url 'http://localhost:8081/submodels?=' \
  --header 'Content-Type: application/json' \
  --data '{
    "modelType": "Submodel",
    "kind": "Instance",
    "id": "mySubmodel",
    "submodelElements": [
        {
            "modelType": "Property",
            "value": "Hello, World!",
            "valueType": "xs:string",
            "idShort": "myProperty"
        }
    ]
}'

GETing $value works as expected

curl --request GET \
  --url 'http://localhost:8081/submodels/bXlTdWJtb2RlbA/$value?=' \
  --header 'Content-Type: application/json'

And returns:

{
    "myProperty": "Hello, World!"
}

But now when I try to Call PATCH

curl --request PATCH \
  --url 'http://localhost:8081/submodels/bXlTdWJtb2RlbA/$value?=' \
  --header 'Content-Type: application/json' \
  --data '{
    "myProperty": "Hello"
}'

I get the following error:

{
    "type": "about:blank",
    "title": "Bad Request",
    "status": 400,
    "detail": "Failed to read request",
    "instance": "/submodels/bXlTdWJtb2RlbA/$value"
}

BaSyx (please complete the following information):

BaSyx configuration The default config: basyx-setup-11.zip

System (please complete the following information): Tested on a Mac [M1 (arm)] & VPS Linux Server

aaronzi commented 3 weeks ago

Hello @FelixMethe, can you please provide the URL you are sending the request to? Or better, maybe the entire request (for example in cURL format), so that we can reproduce this.

FelixMethe commented 3 weeks ago

Hello @aaronzi,

Thank you for your quick response. I have updated the issue.