Skip to content

Links object must be a member of Relationships object #1422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
d3crypt3d opened this issue Jan 11, 2016 · 2 comments
Closed

Links object must be a member of Relationships object #1422

d3crypt3d opened this issue Jan 11, 2016 · 2 comments

Comments

@d3crypt3d
Copy link

I discovered that links object currently is not a member of relationships object.
Here is an example of resource object that I got:

{
  "data": [{
    "id":"980191848",
    "type":"projects",
    "attributes": {
      "name":"optio",
      "created_at":"2016-01-10T17:21:54.266Z",
      "updated_at":"2016-01-10T17:21:54.266Z"
      }, "relationships": {
           "tasks": { 
             "data": [{ 
               "id": "980191660", "type": "tasks"
             }]
         }
      }, "links": {
           "self":"//foo",
           "related":"//bar"
         }
      }
  ]}
}

In other words link object is a neighbour of the relationships one. However, according to JSON API specification, relationships should had included links inside the tasks container:

  "relationships": {
     "tasks": {
       "links": {
         "self":"//foo",
         "related":"//bar"
       }, "data": [{ 
             "id": "980191660", "type": "tasks"
          }]
    }
  }

And it doesn't depend on how the links method is defined:

link :self, '//foo'
# or
def link
  api_path(object)
end

How does the link object could be placed in a proper container?

@beauby
Copy link
Contributor

beauby commented Jan 11, 2016

The JSON API spec defines various types of links. You are looking for relationship-level links, for which I'm working on a PR.

@jordonbiondo
Copy link

#1454

@beauby beauby closed this as completed Jan 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants