Skip to content

The pagination contract is undocumented, misdocumented, and absent from the OpenAPI contract #305

Closed

Description

@thehabes

Summary

These artifacts are supposed to tell a client how to page:

  • openapi/contracts/core-provider.openapi.yaml
  • public/API.html

Proposed change

OpenAPI contract

Add a shared PageLimit / PageSkip pair under components/parameters and reference them from /api/query, /api/search, and /api/search/phrase. Include:

  • The maximums and defaults in each schema.
  • The 400 response for out-of-range and malformed values
  • The Link response header, described as carrying rel="next"
  • The applied-value response headers.
  • The ordering guarantees.
  • The corrected status codes for head: /api/query

Check whether __tests__/openapi_sync_artifacts.test.js and the sync workflow need anything beyond the file edit.

public/API.html

  • Correct the default from 10 to 100.
  • Replace all three "strange behavior" warnings with the actual maximums and what happens when they are exceeded — limit is clamped and reported, skip is rejected.
  • Rewrite pagedQuery to follow rel="next" and terminate on its absence. Note that the next URL is followed with the same POST body, since that is not obvious from a Link header alone.
  • Document the applied-value response headers, the ordering guarantee for each endpoint, and cursor paging with skip described as the bounded random-access alternative.
  • Note the one case the server cannot catch: ?limit[a]=5 never reaches the server as a limit key under Express's simple query parser, so it is indistinguishable from omitting the parameter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions