question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page size as paginate() argument

See original GitHub issue

The idea is to set page size in paginate() function. Maybe as an element of params. So we could get this value from router argument or use some default size.

Something like this:

@router.get('', response_model=Page[ItemList])
async def get_item_list(page_size: int = 20):
    return paginate(items, page_size)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
uriyyocommented, Jul 27, 2021

You can do it by passing size parameter in case of Page or limit parameter in case of LimitOffsetPage.

For instance:

@app.get('/users', response_model=Page[User])
async def get_users():
    return paginate(users)
curl http://localhost:8000/users?size=100
0reactions
uriyyocommented, Jul 27, 2021

No worries)

Read more comments on GitHub >

github_iconTop Results From Across the Web

REST api pagination: make page-size a parameter ...
Personally, I would simply document a maximum page size, and anything larger than that is simply treated as the maximum.
Read more >
What do "pageSize" & "maxPageSize" parameters mean ...
The "pagesize" in the yml is a reference to the size of the page displayed in related to pagination. This allows for large...
Read more >
pageSize, page - Veeam Backup REST API Reference
The pageSize and page query parameters let you control pagination. ... Using the pageSize parameter, you can define the number of items to...
Read more >
Paginators — Boto3 Docs 1.26.32 documentation - AWS
This argument if useful for resuming pagination from a previous token or starting pagination at a known position. PageSize.
Read more >
Using AWS CLI pagination options
By default, the AWS CLI uses a page size determined by the individual service and retrieves all available items. ... How to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found