Closed Bug 1063587 Opened 7 years ago Closed 7 years ago

[Compat Data] Resource collections should be paginated

Categories

(developer.mozilla.org Graveyard :: General, enhancement)

All
Other
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jwhitlock, Unassigned)

References

Details

(Whiteboard: [specification][type:feature])

What problems would this solve?
===============================
Resource lists such as http://doesitwork-dev.allizom.org/api/browsers will just get longer.  To reduce the network size for casual browsers, these responses should be paginated

Who would use this?
===================
Developers browsing the API

What would users see?
=====================
Developers would see the first N resources, and get pagination data including the total number of items, of pages, and the URI for the next and previous paginated sets

What would users do? What would happen as a result?
===================================================
A developer would look for paginated data.  The API would remain snappy for casual browsers.

Is there anything else we should know?
======================================
The planned scheme appears at http://web-platform-compat.readthedocs.org/en/latest/draft/resources.html#list

Django REST Framework has some built-in pagination support which might be handy, or might get in the way:  http://www.django-rest-framework.org/api-guide/pagination

As of Sept 5, 2014, the JSON API spec (http://jsonapi.org/format/) does not have pagination recommendations, except that data should appear in the meta section.

Github issue: https://github.com/jwhitlock/web-platform-compat/issues/9
Blocks: 1063168
Severity: normal → enhancement
Commits pushed to master at https://github.com/mozilla/web-platform-compat

https://github.com/mozilla/web-platform-compat/commit/97d98ce786c9b03d685e0bb69620b8579fa1df60
bug 1063587 - Split "models" from drf_cached_reads

Preparing for adding additional attributes, tests for pagination

https://github.com/mozilla/web-platform-compat/commit/d3544240b9065d228c044247c5a9fb9dca67b3f3
bug 1063587 - CachedQueryset pagination

Add count, to get number of items
Add __getitem__, to support slicing
Add tests for .pks property

https://github.com/mozilla/web-platform-compat/commit/9c40dd114e3235e16cc5bfbc24b7a27cc196e117
bug 1063587 - Paginate API list views

https://github.com/mozilla/web-platform-compat/commit/10f86b17d2163d814d5d99418b7b4d9c2a40a53a
bug 1063587 - Update load_webcompat_data.py

Empty browsers response contains pagination

https://github.com/mozilla/web-platform-compat/commit/8ac6e5f72ecf4858ce5da87fbed8bef717d61e2a
bug 1063587 - jslint

https://github.com/mozilla/web-platform-compat/commit/42cde5e3e092b676f83033760064b369badf6a33
bug 1063587 - Browse app supports pagination

https://github.com/mozilla/web-platform-compat/commit/ac4f253307abe403ceea8fc730779b2969ab6984
bug 1063587 - Add jslint to make qa, if exists

https://github.com/mozilla/web-platform-compat/commit/d66a641d22717f79b361009b739f87ab33e7905e
fix bug 1063587 - Use relation count without GETs

The standard way of counting related items is
{{object.children.length}}, but this causes a GET for each child object.
Instead, we use {{object.data.children.length}}, which uses the related
ID array contained in the private data attribute.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.