flask-stupe icon indicating copy to clipboard operation
flask-stupe copied to clipboard

WIP: Implement pagination headers

Open rambobinator opened this issue 7 years ago • 6 comments

Hi, I PR this as apparently there is a need (@trubesv ). At least we can discuss the implementation.

rambobinator avatar Nov 26 '18 11:11 rambobinator

It lacks a test case, though.

Yep, it really does!

Also, check the Travis build, it's failing.

ramnes avatar Nov 28 '18 09:11 ramnes

Pull Request Test Coverage Report for Build 130

  • 36 of 36 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 108: 0.0%
Covered Lines: 399
Relevant Lines: 399

💛 - Coveralls

coveralls avatar Nov 28 '18 14:11 coveralls

Concerning the current implementation, i tried to stick to the RFC linked by @tobes. Don't you think it's the best thing to do ? https://tools.ietf.org/html/rfc5988#page-6

rambobinator avatar Nov 28 '18 16:11 rambobinator

Don't we want the dict values in the body to only contain the links, without the >; rel='...' part?

ramnes avatar Nov 28 '18 17:11 ramnes

PyMongo already handles that for the limit: it keeps the absolute value and consider 0 as "no limit". We might want to validate that skip is a positive integer though, or just handle the ValueError that PyMongo would raise.

ramnes avatar Nov 29 '18 15:11 ramnes

I think we should simply not offer the relatives links if we're on an edge.

ramnes avatar Nov 29 '18 16:11 ramnes