Description
Preface: this is pretty firmly next version stuff.
As a quick refresher:
- Collection is the base class for representing collections, which are an indirection mechanism and container for some items considered to be part of the collection.
- A Collection can have
items
, but it can also havefirst
/last
/current
. - A Collection with
items
can be considered to be either an unpaged Collection in its entirety, or otherwise it is a CollectionPage that is conceptually part of some larger Collection. - A CollectionPage can have
next
/prev
. Without these, the only way to differentiate between an "unpaged collection" and a "collection page" is to explicitly declare atype
. - CollectionPage inherits from Collection, so more precisely the question is whether it is a "page" or not.
Taking a look at it from the perspective of properties and their domains/ranges:
- Something with
items
is a Collection - Something with
first
/last
/current
is currently also considered to be a Collection, but it is specifically a "paged collection" and not simply a "collection".
We note that:
- It makes no sense to have a collection that is both unpaged and paged, i.e., it makes no sense to have a collection with both
items
andfirst
/last
/current
. This defeats the entire purpose of paging.
Given the conclusion above that a collection cannot or should not be both unpaged and paged at the same time, does it then make sense to say that we ought to reify this with a distinct PagedCollection
type? At the very least, there's something that doesn't quite align, and we ought to think about if anything can be done to reconcile this.
I think that the intent is to have some URI resolve to an object that can be dynamically paged or unpaged, but the model doesn't fully support that. It could be made to support that if we recognized a distinction between a Collection
and a PagedCollection
, though. Clients could even request or negotiate whether they prefer or accept a paged or unpaged collection?