holidayextras / jsonapi-server

A config driven NodeJS framework implementing json:api and GraphQL
MIT License
488 stars 115 forks source link

Cannot change limit of `include`d items #418

Open Redsandro opened 6 years ago

Redsandro commented 6 years ago

When requesting a resource, we can include it's relationships for client-side model postprocessing by using the querystring ?include=:

http://<server>/<model>/<id>?include=<hasManyRelationship>

However, if we want to load 60 tokens for a single resource, the application breaks because jsonapi-server hard-limits the included items to 50.

I tried doing this:

http://<server>/<model>/<id>?include=<hasManyRelationship>&page[limit]=100

But I'm still only getting 50.

I reckon this should be:

  1. Configurable in jsonApi.setConfig(), and
  2. Settable in the request, e.g. page[limit] (or some other include-only parameter)
Redsandro commented 6 years ago

I think we need to forward the pagination request params somewhere, but I am not sure where.

Or add a new parameter page[includelimit], but then we'd still need to forward the request params to the internal include fetch function.

queenvictoria commented 5 years ago

See https://github.com/holidayextras/jsonapi-server/issues/260 for a solution if you've rolled your own handler.

Redsandro commented 5 years ago

Thank you @queenvictoria. This is an awesome project which I used in the past. However certain unaddressed issues (like this one or that one) and the stalled development caused me to move on from jsonapi-server.

There was a fork called jagql but I think it might be stalled too.

For smaller projects I use my own small scoped jsonapi-server-mini. For setting up a jsonapi endpoint on node using express and mongodb, it'll just take one file per route/model. I have yet to see anything simpler.

For more complex projects fortune.js seems interesting.