Skip to content

Links property for relationships #1

@m-bodmer

Description

@m-bodmer

If I have code such as the following:

new JSONAPISerializer('users', data, {
  apiEndpoint: 'http://localhost:3000/api/users',
  attributes: ['firstName', 'lastName', 'books'],
  books: {
    ref: '_id',
    attributes: ['title', 'ISBN']
  }
}).then(function (users) {  
  // `users` here are JSON API compliant. 
});
{
  "links": {
    "self": "http://localhost:3000/api/users"
  },
  "data": [{
    "type": "users",
    "id": "1",
    "attributes": {
      "firstName": "Sandro",
      "lastName": "Munda"
    },
    "relationships": {
      "books": {
        // Is there add a links attribute such as this one for relationships?
        "links": {
          "self": "http://example.com/users/1/relationships/books",
          "related": "http://example.com/users/1/books"
        },
        "data": [
          { "type": "books", "id": "1" },
          { "type": "books", "id": "2" }
        ]
      }
    }
  }

Is there a way I can add the links attribute for compound documents?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions