jakubrohleder / angular-jsonapi

Simple and lightweight, yet powerful ORM for your frontend that seamlessly integrates with your JsonAPI server.

Home Page:http://jakubrohleder.github.io/angular-jsonapi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Retrieving large data set of relationships

hedder opened this issue · comments

Quick example:

{ type: "blog", id: "XX", relationships: { posts: [ Array of 10000] } }

Querying such an object from REST-API including 10000 posts could hang the application.

For such a case, it would be great to retrieve posts from a specific api endpoint:

/update/XX/posts

Any ideas?

Yes, you are right. I have not tested the package for such a huge data sets.

If i understand it right you would like to have something like blog object with empty posts relationship and blog.relationships.posts.fetch() method the enables you to get posts from a specific API endpoint (like blogs/XX/posts) preferably with pagination?

Edit:
I've found an issue on the discuss.jsonapi.org that is connected to the issue.

Paginating relations is a must have for such a scenario.

But for the library we have to have a way to retrieve them independently from the main object. Basically there're 2 ideas of doing that:

  1. blog.relationships.posts.fetch()
  2. posts.all({url: 'blogs/XX/posts'}) - this way we can specify different url from the main to retrieve them