{"action":"created","issue":{"url":"https://api.github.com/repos/matryer/silk/issues/25","repository_url":"https://api.github.com/repos/matryer/silk","labels_url":"https://api.github.com/repos/matryer/silk/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/matryer/silk/issues/25/comments","events_url":"https://api.github.com/repos/matryer/silk/issues/25/events","html_url":"https://github.com/matryer/silk/issues/25","id":135263834,"number":25,"title":"better body assertions: Specify kind of assertion to make","user":{"login":"matryer","id":101659,"avatar_url":"https://avatars.githubusercontent.com/u/101659?v=3","gravatar_id":"","url":"https://api.github.com/users/matryer","html_url":"https://github.com/matryer","followers_url":"https://api.github.com/users/matryer/followers","following_url":"https://api.github.com/users/matryer/following{/other_user}","gists_url":"https://api.github.com/users/matryer/gists{/gist_id}","starred_url":"https://api.github.com/users/matryer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matryer/subscriptions","organizations_url":"https://api.github.com/users/matryer/orgs","repos_url":"https://api.github.com/users/matryer/repos","events_url":"https://api.github.com/users/matryer/events{/privacy}","received_events_url":"https://api.github.com/users/matryer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/matryer/silk/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-21T21:43:54Z","updated_at":"2016-04-06T16:16:10Z","closed_at":null,"body":"## Proposal: better bodies in Silk\r\n\r\nBodies in Silk could make use of the 'formatting' tag thing where not only the data type is specified, but also the kind of assertions that could take place:\r\n\r\n```\r\n``json(mode=exact)\r\n{\r\n  \"name\": \"Silk\",\r\n  \"released\": 2016\r\n}\r\n``\r\n```\r\n\r\n* Two back tics are used so as not to confuse renderer\r\n* This assumes that the text after the opening code block line is never rendered (needs validating)\r\n\r\nThe types of bodies could be:\r\n\r\n* `exact` - the body must match verbatim\r\n* `same` - the JSON must essentially be equal but fields may be in different orders and formatting (whitespace) is ignored\r\n* `subset` - each mentioned field is asserted, additional fields in the body is ignored\r\n\r\nThe syntax highlight language specified could also drive which `ParseBody` function is called.\r\n\r\n### Cons\r\n\r\n* When rendered, you can't see the _kind_ of assertion, but that might not be too much of a problem and could always be explained in the plain text surrounding the block.\r\n\r\n### Alternatives\r\n\r\nOther options to consider:\r\n\r\n* the `json` language specifier might be enough to indicate the datatype, and we could use flags (when running the file) to indicate what type of assertion to make"},"comment":{"url":"https://api.github.com/repos/matryer/silk/issues/comments/206446582","html_url":"https://github.com/matryer/silk/issues/25#issuecomment-206446582","issue_url":"https://api.github.com/repos/matryer/silk/issues/25","id":206446582,"user":{"login":"felixLam","id":1178566,"avatar_url":"https://avatars.githubusercontent.com/u/1178566?v=3","gravatar_id":"","url":"https://api.github.com/users/felixLam","html_url":"https://github.com/felixLam","followers_url":"https://api.github.com/users/felixLam/followers","following_url":"https://api.github.com/users/felixLam/following{/other_user}","gists_url":"https://api.github.com/users/felixLam/gists{/gist_id}","starred_url":"https://api.github.com/users/felixLam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixLam/subscriptions","organizations_url":"https://api.github.com/users/felixLam/orgs","repos_url":"https://api.github.com/users/felixLam/repos","events_url":"https://api.github.com/users/felixLam/events{/privacy}","received_events_url":"https://api.github.com/users/felixLam/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T16:16:10Z","updated_at":"2016-04-06T16:16:10Z","body":"I also agree that flagging json responses as with three backticks and `json` should be enough to enable the \"lenient\" mode."}}