scoutforpets / jsonapi-mapper

JSON API-Compliant Serialization for your Node ORM
The Unlicense
42 stars 24 forks source link

Support for page and pageSize in pagination #85

Open ErisDS opened 8 years ago

ErisDS commented 8 years ago

The JSONAPI Spec is agnostic about pagination strategies: http://jsonapi.org/format/#fetching-pagination

The default bookshelf plugin supports two strategies: https://github.com/tgriesser/bookshelf/wiki/Plugin:-Pagination

The default uses page and pageSize, although limit and offset can also be used.

It would be great if this library could support both.

Whilst I'm here, I must say that whilst I understand why TypeScript is a good choice for this sort of code, it does create a huge barrier to contributing. I'm testing this library out as a way to get from bookshelf to JSONAPI for a couple of APIs I'm building and I'd love to get stuck in and help but I don't know TypeScript 😞

ShadowManu commented 8 years ago

TypeScript won't normally go against you. Try first thinking your ideas in pseudocode, then ES6 and then the types you're handling. There's many things reasons typescript won't get in your way:

jamesdixon commented 8 years ago

@ErisDS certainly open to supporting this!

With regards to Typescript: as @ShadowManu alluded to, the transition isn't nearly as daunting as one may think. I'm the original creator of this library and when I had wrote it, it wasn't typescript. After @ShadowManu did the original rewrite in TS, I jumped in and contributed with very few issues caused by TS. In fact, it was fairly simple. I'd suggest you give it a shot and as @ShadowManu mentioned, we're here to help!

ErisDS commented 8 years ago

I appreciate the positive response to what was a moan, however I'm pretty strapped for time 😁 Could you perhaps add a brief getting started guide to the README or contributing.md that covers how to setup, build the repo, and run the tests? A couple of bullet points & commands would be a real help to get over the wall.

ShadowManu commented 8 years ago

Sounds reasonable. I have a little free time for this. EDIT: the contributing page is now added ;)