Skip to content

Commit

Permalink
Why we should start pagination with zero
Browse files Browse the repository at this point in the history
  • Loading branch information
pieter-pon committed Apr 7, 2023
1 parent fdd2063 commit b4b7638
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions chapters/integration/generic/pagination.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ this may comprise the support for {prev}, {first}, {last}, and {self} as
{link-relations}[link relations] (see also <<link-relation-fields>> for
details).

The first position at the api pagination should be 0, and every next position should be increased by 1.
Starting with zero makes the math simple.
API is designed to consumed by another system, and all code starts lists with zero.
https://en.wikipedia.org/wiki/Zero-based_numbering

If the next position doesn't have results, it shoudn't return a link.

The page content is transported via {items}, while the {query} object may
contain the query filters applied to the collection resource as follows:

Expand Down

0 comments on commit b4b7638

Please sign in to comment.