Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add limit to CursorParams.size field #1119

Merged
merged 3 commits into from
Apr 11, 2024
Merged

Add limit to CursorParams.size field #1119

merged 3 commits into from
Apr 11, 2024

Conversation

barsikus007
Copy link
Contributor

@barsikus007 barsikus007 commented Apr 9, 2024

Resolves #1116

Copy link

codecov bot commented Apr 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.11%. Comparing base (245519c) to head (f46b601).
Report is 163 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1119      +/-   ##
==========================================
+ Coverage   93.26%   94.11%   +0.84%     
==========================================
  Files          35       37       +2     
  Lines        1040     1275     +235     
==========================================
+ Hits          970     1200     +230     
- Misses         70       75       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@uriyyo uriyyo merged commit 257b23f into uriyyo:main Apr 11, 2024
19 checks passed
@nikelborm
Copy link

Yay! 🎉

@marjoleinveenendaal
Copy link

Hi! While I understand the wish, this completely broke multiple parts of our software, as the APIs now send out an HTTPValidationError when requesting more than 100 records at a time (which is perfectly sensible for us). I was not expecting a breaking change in a patch release!

Is there a way we can make this easily overridable? Because from what we can tell we are going to have to write a custom Page to allow for bigger limits. Which seems a bit overkill for such a small setting.

@uriyyo
Copy link
Owner

uriyyo commented Apr 18, 2024

@marjoleinveenendaal I'm so sorry to hear that. It's always such a bad situation when I break someone code(

You can customize size using CustomizedPage:

from fastapi_pagination.cursor import CursorPage as BaseCursorPage
from fastapi_pagination.customization import UseParamsFields, CustomizedPage


CursorPage = CustomizedPage[
    BaseCursorPage,
    UseParamsFields(
        size=Query(50, ge=0),
    ),
]

@marjoleinveenendaal
Copy link

Thanks! This is less complex than we thought, we will implement it like this!

@uriyyo
Copy link
Owner

uriyyo commented Apr 19, 2024

Great, please, let me know if you will have any kind of issues 🙏

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.

Add limit to CursorParams.size field
4 participants