{"action":"created","issue":{"url":"https://api.github.com/repos/apigee-127/swagger-test-templates/issues/94","repository_url":"https://api.github.com/repos/apigee-127/swagger-test-templates","labels_url":"https://api.github.com/repos/apigee-127/swagger-test-templates/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/apigee-127/swagger-test-templates/issues/94/comments","events_url":"https://api.github.com/repos/apigee-127/swagger-test-templates/issues/94/events","html_url":"https://github.com/apigee-127/swagger-test-templates/issues/94","id":124948453,"number":94,"title":"Validation run on string instead of object","user":{"login":"samekmichal","id":4890225,"avatar_url":"https://avatars.githubusercontent.com/u/4890225?v=3","gravatar_id":"","url":"https://api.github.com/users/samekmichal","html_url":"https://github.com/samekmichal","followers_url":"https://api.github.com/users/samekmichal/followers","following_url":"https://api.github.com/users/samekmichal/following{/other_user}","gists_url":"https://api.github.com/users/samekmichal/gists{/gist_id}","starred_url":"https://api.github.com/users/samekmichal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samekmichal/subscriptions","organizations_url":"https://api.github.com/users/samekmichal/orgs","repos_url":"https://api.github.com/users/samekmichal/repos","events_url":"https://api.github.com/users/samekmichal/events{/privacy}","received_events_url":"https://api.github.com/users/samekmichal/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/apigee-127/swagger-test-templates/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-01-05T11:39:45Z","updated_at":"2016-09-04T15:59:24Z","closed_at":null,"body":"Currently, i am experimenting with project `swagger-node`, which utilizes this project - so thats why I report here.\r\n\r\nI am having troubles validate payload responses against defined schemas. The source of the problem is in the test file, where the response body (json string) is not parsed into an object.\r\n\r\nFor illustration, excerpt from file in `/test/api/client/...`\r\n```js\r\n...\r\nfunction(error, res, body) {\r\n  if (error) return done(error);\r\n\r\n  res.statusCode.should.equal(200);\r\n\r\n  // body = '{\"message\": \"here i am\"}'\r\n  validator.validate(body, schema).should.be.true;\r\n  done();\r\n});\r\n...\r\n```\r\n\r\nWhy the response payload does not get converted to an object? When I manually adjust the code the validation succeeds...\r\n```js\r\nvalidator.validate(JSON.parse(body), schema).should.be.true;\r\n```\r\n\r\nShouldnt the template be adjust to reflect this?"},"comment":{"url":"https://api.github.com/repos/apigee-127/swagger-test-templates/issues/comments/244611434","html_url":"https://github.com/apigee-127/swagger-test-templates/issues/94#issuecomment-244611434","issue_url":"https://api.github.com/repos/apigee-127/swagger-test-templates/issues/94","id":244611434,"user":{"login":"noahdietz","id":6644735,"avatar_url":"https://avatars.githubusercontent.com/u/6644735?v=3","gravatar_id":"","url":"https://api.github.com/users/noahdietz","html_url":"https://github.com/noahdietz","followers_url":"https://api.github.com/users/noahdietz/followers","following_url":"https://api.github.com/users/noahdietz/following{/other_user}","gists_url":"https://api.github.com/users/noahdietz/gists{/gist_id}","starred_url":"https://api.github.com/users/noahdietz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noahdietz/subscriptions","organizations_url":"https://api.github.com/users/noahdietz/orgs","repos_url":"https://api.github.com/users/noahdietz/repos","events_url":"https://api.github.com/users/noahdietz/events{/privacy}","received_events_url":"https://api.github.com/users/noahdietz/received_events","type":"User","site_admin":false},"created_at":"2016-09-04T15:59:24Z","updated_at":"2016-09-04T15:59:24Z","body":"@Remco75 have you noticed this at all? It seems weird to me that this looks to be a bug but no one else has reported having trouble with it.\r\n\r\nI dug around the `request` [docs](https://www.npmjs.com/package/request#custom-http-headers) a bit and confirmed that when the data must be accessed they do indeed `JSON.parse()` the `body` param of the callback. "}}
{"actor":{"display_login":"noahdietz"}}