{"action":"created","issue":{"url":"https://api.github.com/repos/json-api/json-api/issues/1305","repository_url":"https://api.github.com/repos/json-api/json-api","labels_url":"https://api.github.com/repos/json-api/json-api/issues/1305/labels{/name}","comments_url":"https://api.github.com/repos/json-api/json-api/issues/1305/comments","events_url":"https://api.github.com/repos/json-api/json-api/issues/1305/events","html_url":"https://github.com/json-api/json-api/issues/1305","id":367712698,"node_id":"MDU6SXNzdWUzNjc3MTI2OTg=","number":1305,"title":"Clarification about the handling of sparse fieldset in documentation","user":{"login":"krainboltgreene","id":334809,"node_id":"MDQ6VXNlcjMzNDgwOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/334809?v=4","gravatar_id":"","url":"https://api.github.com/users/krainboltgreene","html_url":"https://github.com/krainboltgreene","followers_url":"https://api.github.com/users/krainboltgreene/followers","following_url":"https://api.github.com/users/krainboltgreene/following{/other_user}","gists_url":"https://api.github.com/users/krainboltgreene/gists{/gist_id}","starred_url":"https://api.github.com/users/krainboltgreene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krainboltgreene/subscriptions","organizations_url":"https://api.github.com/users/krainboltgreene/orgs","repos_url":"https://api.github.com/users/krainboltgreene/repos","events_url":"https://api.github.com/users/krainboltgreene/events{/privacy}","received_events_url":"https://api.github.com/users/krainboltgreene/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-08T09:47:41Z","updated_at":"2018-10-08T09:48:31Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Given this request/response:\r\n\r\n```\r\nGET /accounts\r\n{\r\n\t\"links\": {\r\n\t\t\"self\": \"http://localhost:3001/accounts\",\r\n\t\t\"next\": \"http://localhost:3001/accounts?page[offset]=2&page[per]=10\",\r\n\t\t\"last\": \"http://localhost:3001/accounts?page[offset]=101&page[per]=10\"\r\n\t},\r\n\t\"data\": [\r\n\t\t{\r\n\t\t\t\"id\": \"cdb211e6-8eaa-44a3-9cad-e63da0b29a4e\",\r\n\t\t\t\"type\": \"accounts\",\r\n\t\t\t\"links\": {\r\n\t\t\t\t\"self\": \"http://localhost:3001/accounts/cdb211e6-8eaa-44a3-9cad-e63da0b29a4e\"\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n}\r\n```\r\n\r\nThe documentation doesn't make it clear if I can then confidantly request:\r\n\r\n```\r\nGET /accounts?fields[accounts]=email\r\n```\r\n\r\nThe current documentation [makes no suggestion about what to do in this situation](http://jsonapi.org/format/#fetching-sparse-fieldsets). Do I return nothing? Do I return a 422? Do I return the full set of fields?\r\n\r\nFurther, if my default payload looks like this:\r\n\r\n```\r\nGET /accounts\r\n{\r\n\t\"links\": {\r\n\t\t\"self\": \"http://localhost:3001/accounts\",\r\n\t\t\"next\": \"http://localhost:3001/accounts?page[offset]=2&page[per]=10\",\r\n\t\t\"last\": \"http://localhost:3001/accounts?page[offset]=101&page[per]=10\"\r\n\t},\r\n\t\"data\": [\r\n\t\t{\r\n\t\t\t\"id\": \"cdb211e6-8eaa-44a3-9cad-e63da0b29a4e\",\r\n\t\t\t\"type\": \"accounts\",\r\n\t\t\t\"attributes\": {\r\n\t\t\t\t\"name\": \"John Arbuckle\",\r\n\t\t\t\t\"age\": 23\r\n\t\t\t}\r\n\t\t\t\"links\": {\r\n\t\t\t\t\"self\": \"http://localhost:3001/accounts/cdb211e6-8eaa-44a3-9cad-e63da0b29a4e\"\r\n\t\t\t}\r\n\t\t}\r\n\t]\r\n}\r\n```\r\n\r\nCan I safely assume I can make this request:\r\n\r\n```\r\nGET /accounts?fields[accounts]=age\r\n```\r\n\r\nWhile the default payload contains it, there's nothing in the spec that guarantees my ability to specify it."},"comment":{"url":"https://api.github.com/repos/json-api/json-api/issues/comments/427776581","html_url":"https://github.com/json-api/json-api/issues/1305#issuecomment-427776581","issue_url":"https://api.github.com/repos/json-api/json-api/issues/1305","id":427776581,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzc3NjU4MQ==","user":{"login":"krainboltgreene","id":334809,"node_id":"MDQ6VXNlcjMzNDgwOQ==","avatar_url":"https://avatars1.githubusercontent.com/u/334809?v=4","gravatar_id":"","url":"https://api.github.com/users/krainboltgreene","html_url":"https://github.com/krainboltgreene","followers_url":"https://api.github.com/users/krainboltgreene/followers","following_url":"https://api.github.com/users/krainboltgreene/following{/other_user}","gists_url":"https://api.github.com/users/krainboltgreene/gists{/gist_id}","starred_url":"https://api.github.com/users/krainboltgreene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krainboltgreene/subscriptions","organizations_url":"https://api.github.com/users/krainboltgreene/orgs","repos_url":"https://api.github.com/users/krainboltgreene/repos","events_url":"https://api.github.com/users/krainboltgreene/events{/privacy}","received_events_url":"https://api.github.com/users/krainboltgreene/received_events","type":"User","site_admin":false},"created_at":"2018-10-08T09:48:31Z","updated_at":"2018-10-08T09:48:31Z","author_association":"CONTRIBUTOR","body":"I thought the lack of a failure a particularly strange omission since `include` has this:\r\n\r\n> If an endpoint does not support the include parameter, it MUST respond with 400 Bad Request to any requests that include it."}}
{"actor":{"display_login":"krainboltgreene"}}