miLibris / flask-rest-jsonapi

Flask extension to build REST APIs around JSONAPI 1.0 specification.
http://flask-rest-jsonapi.readthedocs.io
MIT License
597 stars 153 forks source link

Support offset/limit pagination strategy #32

Closed sergeygrigorev closed 7 years ago

sergeygrigorev commented 7 years ago

Currently used page[number]/page[size] pagination strategy is less flexible than offset/limit strategy. Getting page by number and size is easy and efficient with offset/limit, but getting data given offset and limit can be quite inefficient if we can only set page.

For example, the worst case. We want to get x rows with offset x - 1. We need to get 2x - 1 rows and cut requited locally. If we were using offset/limit pagination strategy we would have downloaded almost twice less data from our server.

It would be better if flask-rest-jsonapi supported both strategies.

akira-dev commented 7 years ago

Yes you're right. I will make an update to manage both pagination strategies asap. But if you want feel free to make a PR.