{"action":"created","issue":{"url":"https://api.github.com/repos/neomerx/json-api/issues/98","labels_url":"https://api.github.com/repos/neomerx/json-api/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/neomerx/json-api/issues/98/comments","events_url":"https://api.github.com/repos/neomerx/json-api/issues/98/events","html_url":"https://github.com/neomerx/json-api/issues/98","id":118248704,"number":98,"title":"Provider a simpler way to map url include and fields parameters to EncodingParameters","user":{"login":"hglattergotz","id":506901,"avatar_url":"https://avatars.githubusercontent.com/u/506901?v=3","gravatar_id":"","url":"https://api.github.com/users/hglattergotz","html_url":"https://github.com/hglattergotz","followers_url":"https://api.github.com/users/hglattergotz/followers","following_url":"https://api.github.com/users/hglattergotz/following{/other_user}","gists_url":"https://api.github.com/users/hglattergotz/gists{/gist_id}","starred_url":"https://api.github.com/users/hglattergotz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hglattergotz/subscriptions","organizations_url":"https://api.github.com/users/hglattergotz/orgs","repos_url":"https://api.github.com/users/hglattergotz/repos","events_url":"https://api.github.com/users/hglattergotz/events{/privacy}","received_events_url":"https://api.github.com/users/hglattergotz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/neomerx/json-api/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"neomerx","id":10420662,"avatar_url":"https://avatars.githubusercontent.com/u/10420662?v=3","gravatar_id":"","url":"https://api.github.com/users/neomerx","html_url":"https://github.com/neomerx","followers_url":"https://api.github.com/users/neomerx/followers","following_url":"https://api.github.com/users/neomerx/following{/other_user}","gists_url":"https://api.github.com/users/neomerx/gists{/gist_id}","starred_url":"https://api.github.com/users/neomerx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neomerx/subscriptions","organizations_url":"https://api.github.com/users/neomerx/orgs","repos_url":"https://api.github.com/users/neomerx/repos","events_url":"https://api.github.com/users/neomerx/events{/privacy}","received_events_url":"https://api.github.com/users/neomerx/received_events","type":"User","site_admin":false},"milestone":null,"comments":8,"created_at":"2015-11-22T07:11:25Z","updated_at":"2015-11-23T15:21:30Z","closed_at":null,"body":"At the application level a developer is presented with the request that might look like this:\r\n\r\n```http\r\nGET /sites/1?include=posts.comments,comments.author&fields[comments]=body HTTP/1.1\r\nAccept: application/vnd.api+json\r\n```\r\n\r\nFrom the test example [EncodeIncludedObjectsTest](https://github.com/neomerx/json-api/blob/master/tests/Encoder/EncodeIncludedObjectsTest.php#L159) we can see that the `include` and `fields` parameters need to be combined (in this example `comments`):\r\n\r\n```php\r\n    public function testEncodeWithRecursiveIncludedObjects()\r\n    {\r\n        $this->author->{Author::LINK_COMMENTS} = $this->comments;\r\n\r\n        $actual = Encoder::instance([\r\n            Author::class  => AuthorSchema::class,\r\n            Comment::class => CommentSchema::class,\r\n            Post::class    => PostSchema::class,\r\n            Site::class    => SiteSchema::class,\r\n        ], $this->encoderOptions)->encodeData($this->site, new EncodingParameters(\r\n            // include only this relation (according to the spec intermediate will be included as well)\r\n            [Site::LINK_POSTS . '.' . Post::LINK_COMMENTS],\r\n            // include only these attributes and links\r\n            [\r\n                'comments' => [Comment::ATTRIBUTE_BODY, Comment::LINK_AUTHOR],\r\n                'posts'    => [Post::LINK_COMMENTS],\r\n                'sites'    => [Site::LINK_POSTS],\r\n            ]\r\n        ));\r\n        :\r\n        :\r\n    }\r\n```\r\n\r\nGiven that the url will contain the includes and fields in separate parameters, it is up to the application level to correctly parse `posts.comments,comments.author` and figure out to create the following for the `$includePaths`:\r\n```php\r\n    [Site::LINK_POSTS . '.' . Post::LINK_COMMENTS], // posts.comments\r\n```\r\nand\r\n```php\r\n    'comments' => [Comment::ATTRIBUTE_BODY, Comment::LINK_AUTHOR /*author*/],\r\n```\r\nfor `$fieldSets`.\r\n\r\nWould it not be better to put this logic in the library?"},"comment":{"url":"https://api.github.com/repos/neomerx/json-api/issues/comments/158966482","html_url":"https://github.com/neomerx/json-api/issues/98#issuecomment-158966482","issue_url":"https://api.github.com/repos/neomerx/json-api/issues/98","id":158966482,"user":{"login":"neomerx","id":10420662,"avatar_url":"https://avatars.githubusercontent.com/u/10420662?v=3","gravatar_id":"","url":"https://api.github.com/users/neomerx","html_url":"https://github.com/neomerx","followers_url":"https://api.github.com/users/neomerx/followers","following_url":"https://api.github.com/users/neomerx/following{/other_user}","gists_url":"https://api.github.com/users/neomerx/gists{/gist_id}","starred_url":"https://api.github.com/users/neomerx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neomerx/subscriptions","organizations_url":"https://api.github.com/users/neomerx/orgs","repos_url":"https://api.github.com/users/neomerx/repos","events_url":"https://api.github.com/users/neomerx/events{/privacy}","received_events_url":"https://api.github.com/users/neomerx/received_events","type":"User","site_admin":false},"created_at":"2015-11-23T15:21:30Z","updated_at":"2015-11-23T15:21:30Z","body":"@lindyhopchris thanks for explanation\r\n\r\n`feature/issue98` branch created"}}