Re: Call for consensus for the pagination design (ISSUE-42)

+1

One question: I take it we are not prescribing a particular URL for the
next/previous links. I.e. "/an-issue/comments?page=2" is really just an
example, we are treating the URL as an opaque link and we do not assume
a predefined UriTemplate with a 'page' variable here, right?

I also started to implement it in hydra-java to see how well it maps to
an already existing paging construct, Spring Hateoas' PagedResources. It
was relatively simple to map, the only catch being the fact that the
underlying class collects all navigation links into the link list of the
collection resource. I had to move them out of the collections link list
into the hydra:view's link list during serialization.

Best regards,
Dietrich

Am 18.10.2015 um 21:18 schrieb Markus Lanthaler:
> It looks like the latest pagination design [1] stroke the right balance and
> finally allows us to move past this contentious issue. Briefly summarized,
> the main issues of the currently specified pagination design is that the
> collection and their pages are conflated which yields to a number of
> problems in practice. This has been tracked as ISSUE-42 [2].
> 
> The proposed solution for that issue is to look at pages of a collection as
> specific *views* on a single underlying collection instead of thinking of
> the collection as the sum of its pages. More concretely, the proposal is to
>  - replace PagedCollection with PartialCollectionView
>  - replace firstPage/nextPage/previousPage/lastPage with
> first/next/previous/last
>  - associate totalItems with Collection instead of PagedCollection
>  - remove itemsPerPage for the time being (we will likely re-introduce it
> with a different name)
> 
> The representation of a specific view on a collection would look somewhat
> like this with the new proposed design:
> 
>   {
>     "@id": "http://api.example.com/an-issue/comments",
>     "@type": "Collection",
>     "member": [ ... ],
>     "totalItems": 150,
>     "view": {
>       "@id": "/an-issue/comments?page=3",
>       "@type": "PartialCollectionView",
>       "first": "/an-issue/comments",
>       "previous": "/an-issue/comments?page=2",
>       "next": "/an-issue/comments?page=4",
>       "last": "/an-issue/comments?page=498",
>     }
>   }
> 
> 
> This serves as a call for consensus. Before I proceed with marking ISSUE-42
> [2] as resolved and implementing the changes in the spec, I would like to
> ask if anyone has any concerns or objections against this proposal.
> 
> Please submit your comments by Saturday, October 24th.
> 
> 
> Thanks,
> Markus
> 
> 
> [1] https://lists.w3.org/Archives/Public/public-hydra/2015Oct/0121.html
> [2] https://github.com/HydraCG/Specifications/issues/42
> 
> 
> --
> Markus Lanthaler
> @markuslanthaler
> 
> 

Received on Tuesday, 20 October 2015 14:25:09 UTC