Constrain the maximum number of results in a query #14917
Closed
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
- Use
MaxLimit
to constrain the maximum number of results.
- Add logic to constrain
limit
intypes.query.Paginate()
andtypes.query.CollectionFilteredPaginate()
.
- Change
MaxLimit
into variable (it's a constant now), so app developers can change the value.
- It would be better to stop using global.