{"action":"created","issue":{"url":"https://api.github.com/repos/hapijs/joi/issues/1348","repository_url":"https://api.github.com/repos/hapijs/joi","labels_url":"https://api.github.com/repos/hapijs/joi/issues/1348/labels{/name}","comments_url":"https://api.github.com/repos/hapijs/joi/issues/1348/comments","events_url":"https://api.github.com/repos/hapijs/joi/issues/1348/events","html_url":"https://github.com/hapijs/joi/issues/1348","id":271212514,"number":1348,"title":"joi.valid with object or array","user":{"login":"rightaway","id":3680078,"avatar_url":"https://avatars0.githubusercontent.com/u/3680078?v=4","gravatar_id":"","url":"https://api.github.com/users/rightaway","html_url":"https://github.com/rightaway","followers_url":"https://api.github.com/users/rightaway/followers","following_url":"https://api.github.com/users/rightaway/following{/other_user}","gists_url":"https://api.github.com/users/rightaway/gists{/gist_id}","starred_url":"https://api.github.com/users/rightaway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rightaway/subscriptions","organizations_url":"https://api.github.com/users/rightaway/orgs","repos_url":"https://api.github.com/users/rightaway/repos","events_url":"https://api.github.com/users/rightaway/events{/privacy}","received_events_url":"https://api.github.com/users/rightaway/received_events","type":"User","site_admin":false},"labels":[{"id":24848505,"url":"https://api.github.com/repos/hapijs/joi/labels/question","name":"question","color":"d4c5f9","default":true}],"state":"open","locked":false,"assignee":{"login":"WesTyler","id":12154939,"avatar_url":"https://avatars1.githubusercontent.com/u/12154939?v=4","gravatar_id":"","url":"https://api.github.com/users/WesTyler","html_url":"https://github.com/WesTyler","followers_url":"https://api.github.com/users/WesTyler/followers","following_url":"https://api.github.com/users/WesTyler/following{/other_user}","gists_url":"https://api.github.com/users/WesTyler/gists{/gist_id}","starred_url":"https://api.github.com/users/WesTyler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WesTyler/subscriptions","organizations_url":"https://api.github.com/users/WesTyler/orgs","repos_url":"https://api.github.com/users/WesTyler/repos","events_url":"https://api.github.com/users/WesTyler/events{/privacy}","received_events_url":"https://api.github.com/users/WesTyler/received_events","type":"User","site_admin":false},"assignees":[{"login":"WesTyler","id":12154939,"avatar_url":"https://avatars1.githubusercontent.com/u/12154939?v=4","gravatar_id":"","url":"https://api.github.com/users/WesTyler","html_url":"https://github.com/WesTyler","followers_url":"https://api.github.com/users/WesTyler/followers","following_url":"https://api.github.com/users/WesTyler/following{/other_user}","gists_url":"https://api.github.com/users/WesTyler/gists{/gist_id}","starred_url":"https://api.github.com/users/WesTyler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WesTyler/subscriptions","organizations_url":"https://api.github.com/users/WesTyler/orgs","repos_url":"https://api.github.com/users/WesTyler/repos","events_url":"https://api.github.com/users/WesTyler/events{/privacy}","received_events_url":"https://api.github.com/users/WesTyler/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2017-11-04T18:14:48Z","updated_at":"2017-11-06T16:58:43Z","closed_at":null,"author_association":"NONE","body":"I want to validate that a value is exactly equal to something. But if I do\r\n\r\n```js\r\njoi.valid([\r\n  { a:1, b:2 },\r\n  { a:3, b:4 },\r\n])\r\n```\r\n\r\nit doesn't match that the object exactly equals the array of objects. With arrays, doing `joi.valid([1, 2, 3 ])` checks that the values can be either 1, 2, or 3, rather than verifying that it's exactly equal to `[1, 2, 3]`. How can I make this work?\r\n\r\nCould some kind of `joi.deepEqual` be added? It's useful for cases where let's say you're receiving something back from a JSON API and need to make sure that some of the keys meet some criteria, but other keys need to exactly equal something."},"comment":{"url":"https://api.github.com/repos/hapijs/joi/issues/comments/342213564","html_url":"https://github.com/hapijs/joi/issues/1348#issuecomment-342213564","issue_url":"https://api.github.com/repos/hapijs/joi/issues/1348","id":342213564,"user":{"login":"rightaway","id":3680078,"avatar_url":"https://avatars0.githubusercontent.com/u/3680078?v=4","gravatar_id":"","url":"https://api.github.com/users/rightaway","html_url":"https://github.com/rightaway","followers_url":"https://api.github.com/users/rightaway/followers","following_url":"https://api.github.com/users/rightaway/following{/other_user}","gists_url":"https://api.github.com/users/rightaway/gists{/gist_id}","starred_url":"https://api.github.com/users/rightaway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rightaway/subscriptions","organizations_url":"https://api.github.com/users/rightaway/orgs","repos_url":"https://api.github.com/users/rightaway/repos","events_url":"https://api.github.com/users/rightaway/events{/privacy}","received_events_url":"https://api.github.com/users/rightaway/received_events","type":"User","site_admin":false},"created_at":"2017-11-06T16:58:43Z","updated_at":"2017-11-06T16:58:43Z","author_association":"NONE","body":"@hueniverse Where can you use that? I can't do so in `valid()`. And I can't use arrays of objects there either.\r\n\r\n@Marsup It's not for tests, it's for ensuring that certain values returned from APIs exactly match various values, since some keys are fixed (based on the inputs), and the others change. However, if deepEqual functionality were available then an additional use case for joi could also for test assertions."}}
{"actor":{"display_login":"rightaway"}}