Skip to content

Commit bf0b17e

Browse files
authored
Always include paging_metadata in paginated list responses (#538)
The AAS Part 2 API spec requires GetPagedResult wrapper on every list response. The previous code omitted it when all results fit on the first page, returning a plain array that clients expecting {"result": [...], "paging_metadata": {...}} could not parse. Fixes #519
1 parent 53f892e commit bf0b17e

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

server/app/interfaces/base.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,7 @@ def _get_slice(cls, request: Request, iterator: Iterable[T]) -> Tuple[Iterator[T
240240
paginated_slice = iter(items[:limit])
241241
next_cursor = str(cursor + limit + 1) if has_more else None
242242

243-
if next_cursor is not None or cursor > 0:
244-
# add metadata if cursor was present in request
245-
paging_metadata = PagingMetadata(cursor=next_cursor)
246-
else:
247-
paging_metadata = None
243+
paging_metadata = PagingMetadata(cursor=next_cursor)
248244
return paginated_slice, paging_metadata
249245

250246
def handle_request(self, request: Request):

0 commit comments

Comments
 (0)