Skip to content

chore(other): replace the page cursor fields with nextPage and previousPage - #22

Merged
DaveTheWebDev merged 1 commit into
mainfrom
chore/pagination-cursors-only
Sep 24, 2026
Merged

DaveTheWebDev merged 1 commit into
mainfrom
chore/pagination-cursors-only

Conversation

@DaveTheWebDev

Copy link
Copy Markdown
Contributor

What

The page object in list responses changes shape.

Removed: endCursor, startCursor, hasNextPage, hasPrevPage, total.
Added: nextPage, previousPage.
Kept: limit.

All three remaining fields are required. The after and before parameter
descriptions now point at the fields that replace the old cursors.

page:
  nextPage: string | null      # pass to `after`; null means no next page
  previousPage: string | null  # pass to `before`; null means no previous page
  limit: integer

Why

A cursor is null exactly when there is no page in that direction, so
hasNextPage and hasPrevPage repeated what the cursors already said. Two
fields could disagree with each other, and clients had to decide which one to
trust. One signal per direction removes that ambiguity.

Dropping total keeps list responses cheap: a total forces the server to count
every matching row on every request, however few rows the client asked for.

Migration

Before After
page.endCursor with page.hasNextPage page.nextPage
page.startCursor with page.hasPrevPage page.previousPage

Page forward until nextPage is null, and backward until previousPage is
null. Clients that displayed a result count from page.total need to drop it.

Testing

npx @redocly/cli@latest lint passes, with the warnings already present on the
default branch and none in the changed files.

@redocly redocly Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cafe

AI Review: 🟢 Completed

Redocly Agent has reviewed your changes and found 1 potential issue(s).

Note

Medium Risk

Introduces breaking changes to the pagination schema across list endpoints by removing existing cursor and total count fields, requiring client and server implementations to update their pagination handling.

Overview

  • Updates the Page schema to replace endCursor, startCursor, hasNextPage, and hasPrevPage with nullable nextPage and previousPage string fields.
  • Removes the total count property from Page and updates the required properties to [nextPage, previousPage, limit].
  • Updates descriptions for After and Before query parameters to reference nextPage and previousPage.

Comment thread openapi/components/schemas/Page.yaml

@DmitryAnansky DmitryAnansky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaveTheWebDev
Looks good, please merge together with the API changes or it short interval.
So that API was in sync with the API description.
Thx

@DaveTheWebDev
DaveTheWebDev merged commit 505cdee into main Sep 24, 2026
7 checks passed
@DaveTheWebDev
DaveTheWebDev deleted the chore/pagination-cursors-only branch September 24, 2026 07:24
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.

2 participants