Skip to content

server: Correct pagination cursor calculation and limit default#526

Merged
s-heppner merged 4 commits into
eclipse-basyx:developfrom
rwth-iat:fix/pagination
May 8, 2026
Merged

server: Correct pagination cursor calculation and limit default#526
s-heppner merged 4 commits into
eclipse-basyx:developfrom
rwth-iat:fix/pagination

Conversation

@hpoeche
Copy link
Copy Markdown

@hpoeche hpoeche commented May 7, 2026

The pagination implemented in app.interfaces.base.BaseWSGIApp._get_slice(...) was not completely following the specification. This pull request bundles the changes that were made to correct the behavior.

Changes

For more details see the individual commit messages.

hpoeche and others added 4 commits May 6, 2026 09:25
The next_cursor value returned by the _get_slice() method
was not converted from 0-based indexing back to 1-based indexing.

To fix this, a value of 1 is added to a returned cursor value.

Fixes eclipse-basyx#520
The default value for the pagination limit in the method
`_get_slice()` was set to 10. The [spec] specifies a different
value of 100.

This changes correct the implementation to be coherent with the spec.

Fixes eclipse-basyx#521

[spec]: https://industrialdigitaltwin.io/aas-specifications/IDTA-01002/v3.1.2/http-rest-api/http-rest-api.html#pagination
Previously the cursor value for the paging_metadata of a paginated
response was passed directly as `Optional[int]` to the constructor
of `APIResponse`. The presence of the `cursor` attribute also
controlled if the response contained a `paging_metadata`. This is
not conform to the [spec] which requires the `paging_metadata` to
be present in every paginated response. In case the response contains
all remaining results, the `cursor` value inside must be omitted.

This changes correct the behavior for `JSONResponse` to follow the
[spec]. As the `PagingMetadata` might carry additional information
in the future, a new class was used to pass all metadata from the
`_get_slice(...)` method to the resulting `APIResponse`.
For `XMLResponse` we mimic the previously implemented encoding of the
`cursor` value.

Fixes eclipse-basyx#519

[spec]: https://industrialdigitaltwin.io/aas-specifications/IDTA-01002/v3.1.2/http-rest-api/http-rest-api.html#pagination
@s-heppner s-heppner merged commit 21ab63a into eclipse-basyx:develop May 8, 2026
13 checks passed
@s-heppner s-heppner deleted the fix/pagination branch May 8, 2026 09:36
Comment thread server/app/interfaces/base.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants