stas / jsonapi.rb

Lightweight, simple and maintained JSON:API support for your next Ruby HTTP API.
MIT License
263 stars 58 forks source link

Non-ORM/AcrtiveRecord support #11

Closed ekampp closed 4 years ago

ekampp commented 5 years ago

Hi, there.

We're using JSON:API do display some information from a graph database. Would you be interested in supporting a PR to add support for other ORMs than ActiveRecord?

As we develop our product we would probably be able to organize and extract the Neo4J logic that we use to support JAON:API on top of Neo4J. Perhaps others would like that option as well.

stas commented 5 years ago

@ekampp thank you, that sounds interesting indeed. Though I don't think we depend on the ActiveRecord right now. A harder dependency is in fact Ransack, as we use it to help with filters...

This project is mainly a set of modules you put togther, so if you can provide a Neo4j jsonapi/filtering1 alternative (or remove it completely), most of the stuff should be working just fine.

The ActiveModel error serializer is used only when needed as well2

There was also an issue related to making things work with Mongoid #2, but since Ransack has support for it, the fix seemed pretty straightforward.

ekampp commented 5 years ago

Not all of the Ransack features are relevant for Neo4J, so it will not be the same coverage.

Both filtering, pagination, and deserialization will probably need to have some work done.

stas commented 4 years ago

Not all of the Ransack features are relevant for Neo4J, so it will not be the same coverage.

@ekampp filtering is entirely powered right now by Ransack. It's highly unlikely that pagination/deserialization will need adjustments. As I mentioned above, consider using the library without the jsonapi/filtering module and see how far you get, since there are no ORM specific calls in there.

I've already used the library for serializing non-ActiveRecord/ActiveModel records, and it worked just fine.

In fact, I'd like to close this issue for now, and just wait for your report/PR if you actually encounter problems with the way things are working now. Feel free to follow-up with comments afterwards.

Thanks again for considering the library for your project! :bowing_man:

ekampp commented 4 years ago

Filtering is exactly a cornerstone of JSON:API. Not using it defeats the purpose.

stas commented 4 years ago

Filtering is exactly a cornerstone of JSON:API. Not using it defeats the purpose.

Please feel free to add me to Ransack issues if you open any, I'll try to help there. I don't think we should discuss Ransack issues here, it's just a different project. Sorry :|