Skip to content

Clarify pagination continuation and sorting rules#253

Open
Mehrn0ush wants to merge 2 commits into
CycloneDX:mainfrom
Mehrn0ush:clarify-pagination-contract
Open

Clarify pagination continuation and sorting rules#253
Mehrn0ush wants to merge 2 commits into
CycloneDX:mainfrom
Mehrn0ush:clarify-pagination-contract

Conversation

@Mehrn0ush

@Mehrn0ush Mehrn0ush commented Jun 3, 2026

Copy link
Copy Markdown

This PR clarifies the opaque pagination contract in spec/openapi.yaml and addresses issues #249, #250, and #251.

The changes define deterministic ordering rules, clarify hasNext / nextPageToken behavior, and specify how pageToken interacts with query parameters and path-scoped resources.

Changes

Deterministic pagination ordering (#249)

  • Define deterministic ordering for paginated results.
  • Product, component, product release, and component release results are ordered first by the selected sortField, then by uuid as a deterministic secondary tie-breaker.
  • Collection pagination uses collection-specific ordering and does not rely on uuid because collection revisions may share the same UUID.
  • Clarify release version sorting semantics and explicitly state that semantic-version precedence is not implied.
  • Define ordering behavior for missing releaseDate values.
  • Fix /componentReleases to use sort-field-component-release instead of sort-field-component.

hasNext and nextPageToken (#250)

  • Remove nextPageToken from required pagination response fields.
  • Specify that nextPageToken MUST be present when hasNext is true.
  • Specify that nextPageToken MUST NOT be included when hasNext is false.
  • Add terminal and non-terminal pagination examples.

pageToken continuation semantics (#251)

  • Clarify that pageToken is opaque and MUST be copied verbatim from a previous nextPageToken.
  • Specify that clients MUST NOT parse, construct, or modify pageToken.
  • Define continuation state, including:
    • pageSize
    • sortField
    • sortOrder
    • result-affecting filters such as idType and idValue
    • request path and path parameters such as parent uuid
  • Specify that clients MUST NOT change result-affecting parameters while using a continuation token.
  • Specify that servers MUST return 400 Bad Request for malformed, invalid, expired, conflicting, wrong-path, or wrong-path-parameter tokens.

Closes #249
Closes #250
Closes #251

@Mehrn0ush Mehrn0ush requested review from madpah and oej as code owners June 3, 2026 18:18
Signed-off-by: Mehrn0ush <mehrnoush.vaseghi@gmail.com>
@Mehrn0ush Mehrn0ush force-pushed the clarify-pagination-contract branch 2 times, most recently from 270e6c2 to d37ddb6 Compare June 4, 2026 10:56

@taleodor taleodor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great points, just want to request one change to exclude pageSize from the token scope.

Comment thread spec/openapi.yaml Outdated
This token MUST be copied verbatim from the `nextPageToken` value returned by the previous response.
Clients MUST NOT parse, construct, or modify this token.

The token represents continuation state for the original query, including `pageSize`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would suggest excluding pageSize from this list, since that is not affecting results, and can be left to clients.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks, that makes sense. I updated the pageToken description to remove pageSize from the continuation state. The token scope now remains limited to sorting, result-affecting filters, and path/path-parameter scope.

Signed-off-by: Mehrn0ush <mehrnoush.vaseghi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants