{"action":"created","issue":{"url":"https://api.github.com/repos/json-api/json-api/issues/587","labels_url":"https://api.github.com/repos/json-api/json-api/issues/587/labels{/name}","comments_url":"https://api.github.com/repos/json-api/json-api/issues/587/comments","events_url":"https://api.github.com/repos/json-api/json-api/issues/587/events","html_url":"https://github.com/json-api/json-api/issues/587","id":72326315,"number":587,"title":"JSON API / JSON-LD integration","user":{"login":"elplatt","id":308312,"avatar_url":"https://avatars.githubusercontent.com/u/308312?v=3","gravatar_id":"","url":"https://api.github.com/users/elplatt","html_url":"https://github.com/elplatt","followers_url":"https://api.github.com/users/elplatt/followers","following_url":"https://api.github.com/users/elplatt/following{/other_user}","gists_url":"https://api.github.com/users/elplatt/gists{/gist_id}","starred_url":"https://api.github.com/users/elplatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elplatt/subscriptions","organizations_url":"https://api.github.com/users/elplatt/orgs","repos_url":"https://api.github.com/users/elplatt/repos","events_url":"https://api.github.com/users/elplatt/events{/privacy}","received_events_url":"https://api.github.com/users/elplatt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/json-api/json-api/labels/extension","name":"extension","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-01T01:20:24Z","updated_at":"2015-05-20T00:32:05Z","closed_at":null,"body":"I've been looking over both specifications, and I can see two approaches for apps wishing to use both:\r\n\r\n1. LD over API: Serve the JSON-LD document as the \"data\" field in the JSON API result.\r\n2. API over LD: Augment the JSON API result with a JSON-LD context object defining the JSON API schema.\r\n\r\n### LD over API\r\nThe advantage is that JSON API wraps the data and JSON-LD formats the data, which seems in line with the intentions of both specs. The challenge is that the \"data\" object is required to have an \"id\" and \"type\" attribute, which is not part of the JSON-LD spec. It's workable but very inconvenient to use both the JSON API type/id and the JSON-LD @type/@id. It would be preferable to change JSON API to use JSON-LD-style @type/@id names and syntax.\r\n\r\n### API over LD\r\nThe advantage is that JSON-LD is general enough that JSON API is a valid subset (if the root object is augmented with an appropriate context/schema). The disadvantage is that because none of the JSON-API data includes @type or @id keys, they would need to be defined in the context. There would be a lot of duplication because each context would have to include definitions for the standard JSON API type/id/self fields.\r\n\r\n### Conclusion\r\nIt seems to me that the LD over API approach would be preferable, but that would require changes to JSON API that aren't backwards compatible (renaming type/self/id fields). I'd be happy to help make these changes."},"comment":{"url":"https://api.github.com/repos/json-api/json-api/issues/comments/103705853","html_url":"https://github.com/json-api/json-api/issues/587#issuecomment-103705853","issue_url":"https://api.github.com/repos/json-api/json-api/issues/587","id":103705853,"user":{"login":"ethanresnick","id":471894,"avatar_url":"https://avatars.githubusercontent.com/u/471894?v=3","gravatar_id":"","url":"https://api.github.com/users/ethanresnick","html_url":"https://github.com/ethanresnick","followers_url":"https://api.github.com/users/ethanresnick/followers","following_url":"https://api.github.com/users/ethanresnick/following{/other_user}","gists_url":"https://api.github.com/users/ethanresnick/gists{/gist_id}","starred_url":"https://api.github.com/users/ethanresnick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethanresnick/subscriptions","organizations_url":"https://api.github.com/users/ethanresnick/orgs","repos_url":"https://api.github.com/users/ethanresnick/repos","events_url":"https://api.github.com/users/ethanresnick/events{/privacy}","received_events_url":"https://api.github.com/users/ethanresnick/received_events","type":"User","site_admin":false},"created_at":"2015-05-20T00:32:05Z","updated_at":"2015-05-20T00:32:05Z","body":">  The \"links\" objects would need \"self\" keys as well, right?\r\n\r\nSure, the `self` key could exist in the JSON-API response and could be annotated with JSON-LD, though neither of these would be required. I've updated the example from my earlier comment to show what that would look like.\r\n\r\n> The one concern I have is naming collisions between the jsonapi keywords and possible schema-defined terms.\r\n\r\nYes, this is a risk/inconvenience. It can always be solved by moving the context closer to the data, but it might be a bit of a pain. Not sure there's anything to do about it, though."}}