{"action":"created","issue":{"url":"https://api.github.com/repos/fknop/hapi-pagination/issues/41","repository_url":"https://api.github.com/repos/fknop/hapi-pagination","labels_url":"https://api.github.com/repos/fknop/hapi-pagination/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/fknop/hapi-pagination/issues/41/comments","events_url":"https://api.github.com/repos/fknop/hapi-pagination/issues/41/events","html_url":"https://github.com/fknop/hapi-pagination/issues/41","id":222171536,"number":41,"title":"Not working correctly with Joi response validation","user":{"login":"garbles9100","id":21175926,"avatar_url":"https://avatars3.githubusercontent.com/u/21175926?v=3","gravatar_id":"","url":"https://api.github.com/users/garbles9100","html_url":"https://github.com/garbles9100","followers_url":"https://api.github.com/users/garbles9100/followers","following_url":"https://api.github.com/users/garbles9100/following{/other_user}","gists_url":"https://api.github.com/users/garbles9100/gists{/gist_id}","starred_url":"https://api.github.com/users/garbles9100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garbles9100/subscriptions","organizations_url":"https://api.github.com/users/garbles9100/orgs","repos_url":"https://api.github.com/users/garbles9100/repos","events_url":"https://api.github.com/users/garbles9100/events{/privacy}","received_events_url":"https://api.github.com/users/garbles9100/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-04-17T16:49:36Z","updated_at":"2017-04-17T17:34:27Z","closed_at":null,"body":"I'm trying to apply Joi response validation to the pagination object generated by hapi-pagination using the following schema:\r\nresponse: {\r\n        schema: {\r\n          meta: {\r\n            count: Joi.number().description('Number of observations in response.'),\r\n            pageCount: Joi.number().description('Total number of pages.'),\r\n            totalCount: Joi.number().description('Total number of observations.'),\r\n            next: Joi.string().description('URL for the next page. Null if no next page.'),\r\n            previous: Joi.string().description('URL for the previous page. Null if no previous page.'),\r\n            self: Joi.string().description('URL for the current page.'),\r\n            first: Joi.string().description('URL for the first page.'),\r\n            last: Joi.string().description('URL for the last page.'),\r\n          },\r\n          results: Joi.array(),\r\n        },\r\n      },\r\n\r\nAnd the response I get back in Postman is basically:\r\n{\r\n  \"meta\": {\r\n    \"count\": 2,\r\n    \"pageCount\": 2,\r\n    \"totalCount\": 5,\r\n    \"next\": null,\r\n    \"previous\": \"XXX/?limit=3&page=1\",\r\n    \"self\": \"XXX/?limit=3&page=2\",\r\n    \"first\": \"XXX/?limit=3&page=1\",\r\n    \"last\": \"XXX/?limit=3&page=2\"\r\n  },\r\n  \"results\": []\r\n}\r\n\r\nAnd yet I keep getting a Joi response validation error stating: \r\n\"totalCount\" is not allowed. \"response\" is not allowed.\r\n\r\nFrom what I can tell, Joi thinks that the response it is checking the schema against contains a \"response\" key and \"totalCount\" key at the top level and yet in Postman I am not seeing a response like that at all.\r\n\r\nHave you seen anything like this and is there any way to work around it?\r\n"},"comment":{"url":"https://api.github.com/repos/fknop/hapi-pagination/issues/comments/294536542","html_url":"https://github.com/fknop/hapi-pagination/issues/41#issuecomment-294536542","issue_url":"https://api.github.com/repos/fknop/hapi-pagination/issues/41","id":294536542,"user":{"login":"fknop","id":6775689,"avatar_url":"https://avatars1.githubusercontent.com/u/6775689?v=3","gravatar_id":"","url":"https://api.github.com/users/fknop","html_url":"https://github.com/fknop","followers_url":"https://api.github.com/users/fknop/followers","following_url":"https://api.github.com/users/fknop/following{/other_user}","gists_url":"https://api.github.com/users/fknop/gists{/gist_id}","starred_url":"https://api.github.com/users/fknop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fknop/subscriptions","organizations_url":"https://api.github.com/users/fknop/orgs","repos_url":"https://api.github.com/users/fknop/repos","events_url":"https://api.github.com/users/fknop/events{/privacy}","received_events_url":"https://api.github.com/users/fknop/received_events","type":"User","site_admin":false},"created_at":"2017-04-17T17:34:26Z","updated_at":"2017-04-17T17:34:26Z","body":"@garbles9100 I moved the logic to a post handler and published to `1.16.0` on npm. Could you give it a try ? It shouldn't break anything as all the tests still pass."}}
{"actor":{"display_login":"fknop"}}