You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The spec does not require a self key on the links hash. Not sure if we want to support that immediately. But we do have to throw an error or transform relationship property names that would serialize as self.
SerializeAsAttribute
We have to rethink this attribute. The options the spec offers for serializing relationships are:
Serialize a string containing the related resource URL.
Serialize an object with the relationship URL keyed at self. I just commented for clarification on the rc2 PR, but I am pretty sure this URL alone is not sufficient.
Serialize an object with linkage to other resources, using type and id or ids. If this option is chosen the linked attributes must be included in the top level linked object, unlike in the past where you could send the related resource's ID but not make a compound document.
Serialize some combination of the above.
The main choice the developer has is:
Do I want to just send a resource URL?
Or should I link to a secondary resource in the compound document?
And of course like we discussed in #27, they might want to make this decision at runtime.
LinkTemplate
This attribute is still useful, since the spec only recommends a format for resource URLs, and the user might need to override that convention. It might make more sense to call it something like: ResourceUrlFormatAttribute. We would also need a way to override the default relationship URL.
The text was updated successfully, but these errors were encountered:
https://github.com/dgeb/json-api/blob/v1rc2/format/index.md#resource-relationships-
Self key
The spec does not require a
self
key on thelinks
hash. Not sure if we want to support that immediately. But we do have to throw an error or transform relationship property names that would serialize asself
.SerializeAsAttribute
We have to rethink this attribute. The options the spec offers for serializing relationships are:
self
. I just commented for clarification on the rc2 PR, but I am pretty sure this URL alone is not sufficient.resource
. This is functionally equivalent to An unexpected property name causes an infinite loop on deserialization #1, but more verbose.type
andid
orids
. If this option is chosen the linked attributes must be included in the top levellinked
object, unlike in the past where you could send the related resource's ID but not make a compound document.The main choice the developer has is:
And of course like we discussed in #27, they might want to make this decision at runtime.
LinkTemplate
This attribute is still useful, since the spec only recommends a format for resource URLs, and the user might need to override that convention. It might make more sense to call it something like:
ResourceUrlFormatAttribute
. We would also need a way to override the default relationship URL.The text was updated successfully, but these errors were encountered: