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

Confusion over default pagination documentation #20

Closed
Wizofgoz opened this issue Feb 6, 2021 · 3 comments
Closed

Confusion over default pagination documentation #20

Wizofgoz opened this issue Feb 6, 2021 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@Wizofgoz
Copy link

Wizofgoz commented Feb 6, 2021

There is some conflicting information in the docs regarding pagination behavior when no page query parameters are sent by the client.

Here, it implies that requests will always be paginated by default by what is defined on the model, or by what is set as the default on the paginator:
Screen Shot 2021-02-05 at 6 08 49 PM

But here, there is a section about forcing pagination when no query parameters are set:
Screen Shot 2021-02-05 at 6 10 54 PM

The latter is the behavior I observe as being correct but the documentation of the former makes this confusing and I'm not sure what the point of it is.

@Wizofgoz Wizofgoz changed the title Confusion over pagination documentation Confusion over default pagination documentation Feb 6, 2021
@lindyhopchris
Copy link
Contributor

Ah yes I can see how that is confusing - thanks for raising.

For the page size section, it's talking about the page size it uses if the client provides page parameter but does not provide a page size for it. For example:

GET /api/v1/posts?page[number]=1

It will return a paginated response, with the page size specified on either the model, or the withDefaultPerPage() method if that has been used.

However if a client calls:

GET /api/v1/posts

i.e. no page parameters, then the response will not be paginated - unless you've set the $defaultPagination property, in which case the client will get a paginated response as per your default pagination settings.

Hope that makes sense? I'll update the docs.

@lindyhopchris
Copy link
Contributor

@Wizofgoz chapter has been updated (but not deployed to the website yet). You can view it here:
https://github.com/laravel-json-api/docs/blob/develop/1.0/schemas/pagination.md#page-size

Does that make it clearer? Both sections have been updated.

@lindyhopchris lindyhopchris added the documentation Improvements or additions to documentation label Feb 6, 2021
@lindyhopchris lindyhopchris added this to the v1.0.0-alpha.3 milestone Feb 6, 2021
@Wizofgoz
Copy link
Author

Wizofgoz commented Feb 6, 2021

@lindyhopchris yes, that makes a lot of sense. Thank you for the prompt response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants