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

Ability to set page[limit] for included resources #260

Open
noelfelix opened this issue Mar 3, 2017 · 1 comment
Open

Ability to set page[limit] for included resources #260

noelfelix opened this issue Mar 3, 2017 · 1 comment
Labels

Comments

@noelfelix
Copy link

Apologies if I've overlooked this, but I am wondering if it is possible to set page[limit] params for included resources.

@st3xupery
Copy link
Contributor

I think according to the spec there should be no limit to what's included... as far as my readings tell me in the spec sheet for pagination. if a particular resource has a many "relationship" of 200 then technically it seems like it should include all of them.

However, the actual enactment of page limits occurs in the handlers, and if you are programming your own handler you have full control of what you manually trim before sending to the callback.

I faced a dilemma with my handler cutting off the includes at 50 which was the default page limit. This was not the behaviour I wanted as I needed all of the includes that were past the 50 limit per resource. My solution to this issue was to have my handler check if the resource being called was being called internally from the include processes in the JSON:API-Server code by running this condition:

const internalRouting = request.originalUrl.indexOf(route.base + route.path) === -1;

and then skipping past the include slicing.

That's my insight on the matter, let me know if that helps.

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

No branches or pull requests

3 participants