Skip to content

support for relationship links when no data exists #69

@jamesdixon

Description

@jamesdixon

It appears that I may have been mis-understanding/underestimating the value of links provided by the JSON API-spec. I'm using Ember on the front-end can use the related link of a relationship to asynchronously load relationship data when needed. For example, if I have a customer model with a pets relationship and that pets relationship contains ONLY a links attribute, Ember Data will use the related attribute of links to automatically load that data. This allows for much more efficient loading of data, on-demand.

However, with the mapper, we currently require relationship data in order to build said relationships.

My proposal is a method for passing a list of relationships to the mapper. These relationships can than be cross-referenced against the relationships passed along with the Bookshelf model. If there is no relationship in the model, the mapper would simply build the appropriate link. Otherwise, if there is data, the mapper would build out the relationship as normal.

Thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions