eclipse-basyx / basyx-java-server-sdk

MIT License
60 stars 47 forks source link

[BUG] The Basic Discovery Service Should Return A Cursor That Is Useful For The Subsequent Request #422

Open geso02 opened 2 months ago

geso02 commented 2 months ago

The Basic Discovery Service should return a cursor that is useful for the subsequent request. If I do a GET-Request on the following URL: /lookup/shells?limit=2

I get this response for my test:

{
  "paging_metadata" : {
    "cursor" : "https://acplt.org/Test_AssetAdministrationShell2"
  },
  "result" : [ "https://acplt.org/Test_AssetAdministrationShell1", "https://acplt.org/Test_AssetAdministrationShell2" ]
}

Also for other services, the id of the last item of the result list is returned, but it is always base64-url-encoded.

I can't use this cursor for the next request:

http://..../lookup/shells?limit=2&cursor=https://acplt.org/Test_AssetAdministrationShell2

To Reproduce

  1. Start the Basic Discovery Service
  2. Add multiple resources using this endpoint: POST /lookup/shells/{aasIdentifier}
  3. Request less resources than deployed: /lookup/shells?limit=2
  4. Have a look at the response body

Expected behavior

I would like to have a cursor that I can reuse for the next request. The shell id should be base64-url-encoded.

BaSyx (please complete the following information):

System (please complete the following information):

geso02 commented 2 months ago

I just tried to do the GET request for my example and it works:

curl http://localhost:8091/lookup/shells?cursor=https://acplt.org/Test_AssetAdministrationShell2
=>{"paging_metadata":{},"result":["https://acplt.org/Test_AssetAdministrationShell3"]}

Seems as curl and postman are quiet fault-tolerant. But at least when I have an id like this 'this&is=a&test' or spaces in the id, we will have a problem.

aaronzi commented 2 months ago

Hi Gerhard, Thanks for reporting this bug. We will look into it. And as always, if you have the time, please feel free to provide the fix yourself.

I will move this bug ticket to ready to be picked up. If you decide to work on it, please let me know.