Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving all Entity Types only returns the Types of the first 20 elements. #1698

Open
cfreyfh opened this issue Oct 18, 2024 · 4 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@cfreyfh
Copy link

cfreyfh commented Oct 18, 2024

When retrieving all Entity Types through the endpoint /ngsi-ld/v1/types there is a problem with the backend:

In the MongoDB query function

int limit = orionldState.uriParams.limit;
the URL parameters limit and offset are used for the query.

The first problem is that it is not allowed to pass the limit and offset parameters to that endpoint.

{
    "type": "https://uri.etsi.org/ngsi-ld/errors/BadRequestData",
    "title": "Unsupported URI parameter",
    "detail": "limit"
}

So only the first 20 (the default value for limit) elements are returned from the MongoDB and only the types from these entities are returned. Even if the URL parameters would be allowed, I think it makes no sense to use them in that way since the behaviour of the two parameters would be not as intended.

@kzangeli
Copy link
Collaborator

Ok, noted.
Seems like a very silly bug!
Thanks for finding it.
I should have a fix real soon.

@kzangeli kzangeli self-assigned this Oct 18, 2024
@kzangeli kzangeli added the bug Something isn't working label Oct 18, 2024
@kzangeli
Copy link
Collaborator

So, you are right in everything you say.
Seems like I was thinking of something else when I implemented this. Makers zero sense.
I'll have to rewrite the whole thing.
BUT, no time for that right now, so I'll do a quick and dirty thing that at least makes you able to extract all types, with pagination, even though the limit/offset are on entities and not entity types:

  1. Allow limit/offset
  2. Set default limit to 1000 (unless set to anything else by the user)

So, in a first request you get one batch of entity types (only God knows how many).
In the next "paginated" request (offset=1000) you get a second batch (might get entity types from batch 1).

Quite bad, sorry, but at least much better than it was.

We will not close this issue until I've rewritten the whole thing.

kzangeli added a commit that referenced this issue Oct 22, 2024
Not fixed but slightly improved the error of issue #1698
@kzangeli
Copy link
Collaborator

So, I think I got the library error fixed.
Please test again, using the tag 1.8.0-PRE-1640 in dockerhub.

Remember it's not really fixed, just the dirty hack that I described earlier.

@cfreyfh
Copy link
Author

cfreyfh commented Oct 23, 2024

Thank you, now we can get all the types as we need :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants