Skip to content

[FEAT #802] Implement standardized pagination with offset and cursor support#6012

Closed
zxy0314-work wants to merge 1 commit into
UnsafeLabs:mainfrom
zxy0314-work:fix-802-fastapi-pagination
Closed

[FEAT #802] Implement standardized pagination with offset and cursor support#6012
zxy0314-work wants to merge 1 commit into
UnsafeLabs:mainfrom
zxy0314-work:fix-802-fastapi-pagination

Conversation

@zxy0314-work
Copy link
Copy Markdown

🎯 Bounty #802 - $700

Deliverables

  • fastapi/fastapi/pagination.py with Paginator class
  • Offset pagination (page, page_size, total_pages, has_next/has_previous)
  • Cursor pagination (base64-encoded cursor for navigation)
  • PaginatedResponse[T] and CursorResponse[T] generic types
  • FastAPI dependency injection via paginate_dependency()
  • Works with any Pydantic model as item type
  • In-memory list and SQLAlchemy support

Usage

from fastapi import APIRouter, Depends
from pagination import paginate_dependency, Paginator, PaginatedResponse

router = APIRouter()
paginator = Paginator()

@router.get("/items", response_model=PaginatedResponse[Item])
async def list_items(params=Depends(paginate_dependency)):
    all_items = get_items()
    return paginator.paginate(all_items, params)

Payment

ETH: 0x14bb9cE9eD70a24321Ae9aBf2734981CA4b5Fe63
📧 Contact: zxy0314@claw.163.com

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Unfortunately the changes in this PR didn't fully resolve the issue. Please rework your solution and submit a new pull request.

Make sure to review the acceptance criteria in the linked issue and verify all conditions are met before resubmitting. See CONTRIBUTING.md for guidelines.

@github-actions github-actions Bot closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant