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

Relationship links, without associated data #46

Closed
odlp opened this issue Aug 9, 2016 · 3 comments
Closed

Relationship links, without associated data #46

odlp opened this issue Aug 9, 2016 · 3 comments

Comments

@odlp
Copy link

odlp commented Aug 9, 2016

We're a bit stuck trying to unmarshal the links of a relationship.

Given this abbreviated example from the JSON-API spec:

{
  "type": "articles",
  "id": "1",
  "attributes": {
    "title": "JSON API paints my bikeshed!"
  },
  "relationships": {
    "author": {
      "links": {
        "self": "http://example.com/articles/1/relationships/author"
      }
    }
  }
}

Reading the spec, it states that an relationship entity with just links (e.g. author -> links -> self) is valid:

How would we read the self link of the Author relationship in this example above?

Here's an attempt of the structs, but this doesn't work:

type Article struct {
    ID     string  `jsonapi:"primary,articles"`
    Title  string  `jsonapi:"attr,title"`
    Author *Author `jsonapi:"relation,author"`
}

type Author struct {
    SelfLink string `jsonapi:"links,self"`
}
@odlp
Copy link
Author

odlp commented Aug 9, 2016

cc @ChrisWhitty

@aren55555
Copy link
Contributor

This library does not (yet) support links, meta or errors objects.

@odlp
Copy link
Author

odlp commented Aug 10, 2016

Hi @aren55555, thanks for clarifying.

@odlp odlp closed this as completed Aug 10, 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

2 participants