useo-pl / jsom-pagination Goto Github PK
View Code? Open in Web Editor NEWA JSON:API pagination support
License: MIT License
A JSON:API pagination support
License: MIT License
It would be nice to have a real Rails/Hanami/Sinatra applications to be sure everything is working well for all those frameworks and the documentation is valid.
Run all our tests automatically using github actions - it would be nice to have also the automatic gem push for rubygems.
References: You can look up for the existing implementation on FastCQRS gem
Currently, to get the paginator, we need to instantiate the object in the index class.
paginator = JSOM::Pagination::Paginator.new
paginated = paginator.call(collection, params: { number: 2, size: 3 }, base_ur: 'https://example.com')
It would be nice to instantiate it once during the application boot and allow to reuse the same object whenever it's needed. We could use dry-system
for that:
include JSOM::Pagination::Import['paginator']
paginated = paginator.call(collection, params: { number: 2, size: 3 }, base_ur: 'https://example.com')
Currently we use Constant to define default page size.
This should be configurable, as when the default page size is requested, it's not included in the links
.
Suggested solution:
Add singleton
configuration
class for JSOM:Pagination
Hello, thanks for making this gem. It has been really great to use and easy to get up and running.
That being said, I ran into a small issue with the pagination link section when I use arrays as query parameters.
I am making the request: http://localhost:3002/api/recipes?include[]=photo&include[]=nutrition_summary
And getting the return:
}
...
"links": {
"self": "http://localhost:3002/api/recipes?include=photo=nutrition_summary",
"next": "http://localhost:3002/api/recipes?include=photo=nutrition_summary&page[number]=2",
"last": "http://localhost:3002/api/recipes?include=photo=nutrition_summary&page[number]=693"
}
}
Is there something I am missing from the configuration?
Codeclimate allows detecting code smells, and the maintainability level.
Is it valuable enough to integrate it too? You can check out the example report here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.