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

Throw error if pagination amount <= 0 is requested #765

Merged
merged 9 commits into from
May 2, 2019

Conversation

spawnia
Copy link
Collaborator

@spawnia spawnia commented Apr 30, 2019

Related Issue/Intent

Resolves #760

Changes

This prevents an issue where Laravel defaulted to the Model's $perPage amount when a user
requested a count of 0. The paginate_max_amount setting was ignored in this case.

Now, if a client tries to request a paginated field with an amount of <= 0, they will be met with an error:

Requested pagination amount must be more than 0, got 0.

To make this change easier and apply consistent behaviour to all paginated fields (@paginate and @hasMany), i refactored some parts around how the pagination arguments are handled.

Breaking changes

Nope

@spawnia spawnia changed the title WIP: Deal with queries for pagination with count/first of 0 Throw error if pagination amount <= 0 is requested May 2, 2019
@spawnia spawnia requested a review from chrissm79 May 2, 2019 07:15
@chrissm79
Copy link
Contributor

Great job @spawnia, thanks!!

@chrissm79 chrissm79 merged commit 9fc0ce2 into master May 2, 2019
@chrissm79 chrissm79 deleted the pagination-count-zero branch May 2, 2019 13:51
@zjbarg
Copy link

zjbarg commented May 5, 2019

That was fast, you guys are awesome, thank you. @spawnia

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.

Pagination maxCount is ignored when querying for count: 0
3 participants