{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/312","repository_url":"https://api.github.com/repos/spring-projects/spring-restdocs","labels_url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/312/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/312/comments","events_url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/312/events","html_url":"https://github.com/spring-projects/spring-restdocs/issues/312","id":182065291,"number":312,"title":"New snippet type for individual fields in response","user":{"login":"dsyer","id":124075,"avatar_url":"https://avatars.githubusercontent.com/u/124075?v=3","gravatar_id":"","url":"https://api.github.com/users/dsyer","html_url":"https://github.com/dsyer","followers_url":"https://api.github.com/users/dsyer/followers","following_url":"https://api.github.com/users/dsyer/following{/other_user}","gists_url":"https://api.github.com/users/dsyer/gists{/gist_id}","starred_url":"https://api.github.com/users/dsyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsyer/subscriptions","organizations_url":"https://api.github.com/users/dsyer/orgs","repos_url":"https://api.github.com/users/dsyer/repos","events_url":"https://api.github.com/users/dsyer/events{/privacy}","received_events_url":"https://api.github.com/users/dsyer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-10-10T17:01:36Z","updated_at":"2016-10-25T09:45:59Z","closed_at":null,"body":"I have found that I want to document the existence of the fields (with some brief description) in the table (or something similar), and then make more detailed notes about the content below that, with separate snippets for each subfield that I want to document. This means that I need a new snippet type for an individual response field, something like new ResponseFieldSnippet(\"foo.bar\") to extract the foo.bar field from the response.\r\n\r\nThe only difficult part for me has been parsing the field specification (\"foo.bar\" in the example above) and extracting the right parts of the response. Especially difficult when one of the fields traversed is an array because you might want a specific array element and be unwilling to specify it by index (in case the order wasn't deterministic).\r\n\r\nA further complication with arrays is that the logical file name for an extracted field snippet is the path used to extract it (\"foo.bar\" in the example generates \"foo.bar.adoc\"), but if the path has an array index (e.g. \"foo.bar[0]\") then you can't include it in Asciidoctor because of the way the include gets parsed. I had to adopt a convention that I stripped out the indexed parts from a path before I generated the file name."},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/comments/255988544","html_url":"https://github.com/spring-projects/spring-restdocs/issues/312#issuecomment-255988544","issue_url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/312","id":255988544,"user":{"login":"wilkinsona","id":914682,"avatar_url":"https://avatars.githubusercontent.com/u/914682?v=3","gravatar_id":"","url":"https://api.github.com/users/wilkinsona","html_url":"https://github.com/wilkinsona","followers_url":"https://api.github.com/users/wilkinsona/followers","following_url":"https://api.github.com/users/wilkinsona/following{/other_user}","gists_url":"https://api.github.com/users/wilkinsona/gists{/gist_id}","starred_url":"https://api.github.com/users/wilkinsona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilkinsona/subscriptions","organizations_url":"https://api.github.com/users/wilkinsona/orgs","repos_url":"https://api.github.com/users/wilkinsona/repos","events_url":"https://api.github.com/users/wilkinsona/events{/privacy}","received_events_url":"https://api.github.com/users/wilkinsona/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T09:45:59Z","updated_at":"2016-10-25T09:45:59Z","body":"Thanks, @dsyer. The first step toward what you want would appear to be a snippet for body of a request or a response. I've opened #318 for that. The ability to produce a snippet for a portion of a request or response body could then be built on top of that (#319). I'll keep this issue for the table-based approach I described [above](https://github.com/spring-projects/spring-restdocs/issues/312#issuecomment-252875040)."}}
{"actor":{"display_login":"wilkinsona"}}