Skip to content

Constrain the maximum number of results in a query #14917

Closed
@0Tech

Description

Summary

Query server should be able to constrain the maximum number of results in a single page.

Problem Definition

For now, end-users can request a query with a pagination of any limit. It means a huge size of the response.

This change would not introduce a break-change, and the clients already expect this behavior (refer: https://cloud.google.com/apis/design/design_patterns#list_pagination).

Proposal

  1. Use MaxLimit to constrain the maximum number of results.
  • Add logic to constrain limit in types.query.Paginate() and types.query.CollectionFilteredPaginate().
  1. Change MaxLimit into variable (it's a constant now), so app developers can change the value.
  • It would be better to stop using global.

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions