Skip to content

Conversation

@doubledare704
Copy link
Contributor

  • Created PaginatedRequestQuery Pydantic model in fastcrud/paginated/schemas.py

    • Encapsulates all pagination query parameters (offset, limit, page, items_per_page, sort)
    • Includes comprehensive docstring with usage examples
    • Supports both page-based and offset-based pagination modes
    • Uses Field descriptions for OpenAPI documentation
    • Configured with populate_by_name for alias support
  • Refactored _read_items endpoint in fastcrud/endpoint/endpoint_creator.py

    • Now uses PaginatedRequestQuery with Depends() instead of individual Query parameters
    • Maintains backward compatibility with existing API behavior
    • Updated docstring to mention the new schema-based approach
  • Updated fastcrud/paginated/init.py to export PaginatedRequestQuery

  • Added comprehensive tests in tests/sqlalchemy/paginated/test_schemas.py

    • Tests for default values, pagination params, offset/limit, sorting
    • Tests for alias support and populate_by_name configuration
    • All 15 tests passing
  • Added reusability tests in tests/sqlalchemy/endpoint/test_paginated_request_query_reusability.py

    • Demonstrates using PaginatedRequestQuery in custom endpoints
    • Tests OpenAPI schema generation
    • Tests subclassing capability for custom extensions
    • All 10 tests passing
  • Updated documentation in docs/advanced/endpoint.md

    • Added new section 'Reusing Pagination Query Parameters'
    • Includes examples of using PaginatedRequestQuery in custom endpoints
    • Shows how to extend the schema with custom parameters
    • Documents benefits of using the schema

Resolves #258

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • I have added necessary documentation (if appropriate).
  • I have added tests that cover my changes (if applicable).
  • All new and existing tests passed.

Additional Notes

Include any additional information that you think is important for reviewers to know.

doubledare704 and others added 6 commits October 25, 2025 17:10
…(issue benavlabs#258)

- Created PaginatedRequestQuery Pydantic model in fastcrud/paginated/schemas.py
  - Encapsulates all pagination query parameters (offset, limit, page, items_per_page, sort)
  - Includes comprehensive docstring with usage examples
  - Supports both page-based and offset-based pagination modes
  - Uses Field descriptions for OpenAPI documentation
  - Configured with populate_by_name for alias support

- Refactored _read_items endpoint in fastcrud/endpoint/endpoint_creator.py
  - Now uses PaginatedRequestQuery with Depends() instead of individual Query parameters
  - Maintains backward compatibility with existing API behavior
  - Updated docstring to mention the new schema-based approach

- Updated fastcrud/paginated/__init__.py to export PaginatedRequestQuery

- Added comprehensive tests in tests/sqlalchemy/paginated/test_schemas.py
  - Tests for default values, pagination params, offset/limit, sorting
  - Tests for alias support and populate_by_name configuration
  - All 15 tests passing

- Added reusability tests in tests/sqlalchemy/endpoint/test_paginated_request_query_reusability.py
  - Demonstrates using PaginatedRequestQuery in custom endpoints
  - Tests OpenAPI schema generation
  - Tests subclassing capability for custom extensions
  - All 10 tests passing

- Updated documentation in docs/advanced/endpoint.md
  - Added new section 'Reusing Pagination Query Parameters'
  - Includes examples of using PaginatedRequestQuery in custom endpoints
  - Shows how to extend the schema with custom parameters
  - Documents benefits of using the schema

All existing tests pass (56 endpoint tests + 15 paginated tests = 71 total)
Resolves benavlabs#258
@igorbenav igorbenav merged commit eb963e9 into benavlabs:main Nov 4, 2025
7 checks passed
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.

Support for Query params schema for Read Items endpoint

2 participants