You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, I want to use only page[number] without page[size]. Currently handleIndex will ignore PaginatedFindAll (Because pagination.isValid() is false) and call to FindAll. If this time my resource does not implement FindAll, then the 404 error.
I think we do not need to call pagination.isValid() in handleIndex, let this be for PaginatedFindAll. So I can customize my API more easily.
What do you think about this?
The text was updated successfully, but these errors were encountered:
Depends on the reason of why do you want to omit the page size.
I've been trying to wrap my head around the idea but it kinda always results in some kind of fallback size which the server knows. Since jsonapi wants to give the client full control of the backend, I'd rather not omit it, if that's the case.
If the case is, that for the first page you want to specify the page length, and for further requests omit it, then we should look into supporting cursor based pagination (http://jsonapi.org/format/#fetching-pagination) which we currently don't support but is in my opinion the better solution.
For example, I have a resource called Profile. When my client requests to /profiles without any page[number] or page[size] parameters, I want the server to return to the client a paginated result and include the links (next, prev, first, last). Currently I will have to manually create the list of links in the FindAll function and insert it into the Response.
I think instead of using pagination.isValid() in handleIndex, we will validate the parameters in PaginatedFindAll, and PaginatedFindAll will return a "PaginationParams" struct like this:
type PaginationParams struct {
number, size, offset, limit uint64
total uint
}
Finally, the "paginationQueryParams" struct will use the above data to generate links.
In some cases, I want to use only page[number] without page[size]. Currently handleIndex will ignore PaginatedFindAll (Because pagination.isValid() is false) and call to FindAll. If this time my resource does not implement FindAll, then the 404 error.
I think we do not need to call pagination.isValid() in handleIndex, let this be for PaginatedFindAll. So I can customize my API more easily.
What do you think about this?
The text was updated successfully, but these errors were encountered: