Attributes "relationships" and "links" allowed?


#1

I found another definition in the JSON API 1.0 spec, that’s a bit unclear and a possible bug.

The following attributes are both invalid, because attribute VALUES contain “relationships” and “links” in one level:

{
  /*...*/
  "attributes": {
    "foo": {"links": "bar"},
    "bla": [[{"relationships": "blubs"}]]
  }
  /*...*/
}

But the attributes object itself is not included in the defined limitation, so this seems to be valid:

{
  /*...*/
  "attributes": {
    "links": "foo",
    "relationships":"bar"
  }
  /*...*/
}

As I don’t know why these keys have been reserved, I would like to know if this is the intended behavior.


#2

Yup, this is the intended behavior! That is, your first example document is illegal but the second is legal.

These keys were reserved to enable the possibility of linking from complex attributes (#383), and that only requires reserving the "links" and "relationships" keys within attribute values.