Open StevieBoyWonder opened 3 years ago
It might make more sense to pass in a context object rather than what you are asking for; something that can be passed through all the functions.
Yeah, I completely agree and that seems to be what alternative libraries do as well. They have this god level (extraData) param that is supplied at the top level and is propagated through as the structure is created.
Issues
The current pagination interface/classes do not accept enough parameters to create proper links
Details
Since the paginator is attached to a Serializer, the Paginator constructor can only accept the object or an Array of objects. However, to correctly use page-based pagination, you need the current query params supplied to a request to be available as well as a metaValue total.
Ex. (Articles Collection has 85 records)
GET /articles?page[number]=1&page[size]=10
Should fetch the first ten articles and serialize them. The resulting pagination links should beNotice how the information here is only derivable given the request query params. In addition, a total needs to be supplied in some way to the serializer.