Skip to content
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

RC2: Resource Relationships #60

Open
csantero opened this issue Feb 10, 2015 · 0 comments
Open

RC2: Resource Relationships #60

csantero opened this issue Feb 10, 2015 · 0 comments
Labels
Milestone

Comments

@csantero
Copy link
Collaborator

https://github.com/dgeb/json-api/blob/v1rc2/format/index.md#resource-relationships-

Self key

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:

  1. Serialize a string containing the related resource URL.
  2. 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.
  3. Serialize an object with the related resource URL keyed at resource. This is functionally equivalent to An unexpected property name causes an infinite loop on deserialization #1, but more verbose.
  4. 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.
  5. Serialize some combination of the above.

The main choice the developer has is:

  1. Do I want to just send a resource URL?
  2. 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.

@csantero csantero added this to the 0.4.0 milestone Feb 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant