Skip to content

Add pagination support to Services and Service Types responses #58

Description

@AnonymousXC

Current Working

The Services view (and Service Types view) currently loads all results in a single request. As registries grow, this will become a performance and UX problem. Pagination needs to be added.

Both GET /services and GET /services/types return bare JSON arrays with no query parameters for pagination and no pagination metadata in the response.

TASC pagination guide: Recommends either page-based (page + page_size) or token-based (token + page_size) pagination, with a response envelope of the form { results: [...], pagination: { page, page_size, total, ... } }. We will be using the page + page_size approach.

Backwards-compatible approach

  1. Accept two optional query parameters on GET /servicesand GET /services/types - page and page_size
  2. When neither parameter is provided, return all results or the full json(as the current response).
  3. When pagination parameters are present, return the response as the pagination guide suggests ({ results: [...], pagination: { page, page_size, total, ... } }).
  4. Return 400 Bad Request if page exceeds available pages.

This is backwards-compatible approach to add pagination without breaking the existing clients.

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