Hyral icon indicating copy to clipboard operation
Hyral copied to clipboard

normalizePaging for jsonApi is not working as expected.

Open jurcello opened this issue 5 years ago • 3 comments

const numPages = parseInt(query.page.number, 10);
const numPerPage = parseInt(query.page.size, 10);

It tries to read the paging using the page query parameter, but jsonAPI returns page[offset] and page[limit]

jurcello avatar Nov 05 '19 10:11 jurcello

Not always! JSON:API standard describes both actually. Any fix should be able to handle both situations.

mnugter avatar Nov 05 '19 10:11 mnugter

That's a good one. In that case we should write a dedicated parser for the Drupal one, because at the moment it fails at parsing the paging information for Drupal.

Maybe the best way to do this is to define parsers for both situations and let another function detect which parser to use.

jurcello avatar Nov 05 '19 11:11 jurcello

In fact JSON:API is agnostic about the pagination strategy that is used by an API (server). Well know strategies include page, offset and cursor based, but are not limited to them.

I.m.o we should allow the client to specify which strategy Hyral should use.

StevenButeneers avatar Nov 12 '19 10:11 StevenButeneers