{"action":"created","issue":{"url":"https://api.github.com/repos/dry-rb/dry-validation/issues/95","repository_url":"https://api.github.com/repos/dry-rb/dry-validation","labels_url":"https://api.github.com/repos/dry-rb/dry-validation/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/dry-rb/dry-validation/issues/95/comments","events_url":"https://api.github.com/repos/dry-rb/dry-validation/issues/95/events","html_url":"https://github.com/dry-rb/dry-validation/issues/95","id":145996313,"number":95,"title":"Predicate :number? inside \"each\" macro causes errors","user":{"login":"lukaszbieniek","id":1224440,"avatar_url":"https://avatars.githubusercontent.com/u/1224440?v=3","gravatar_id":"","url":"https://api.github.com/users/lukaszbieniek","html_url":"https://github.com/lukaszbieniek","followers_url":"https://api.github.com/users/lukaszbieniek/followers","following_url":"https://api.github.com/users/lukaszbieniek/following{/other_user}","gists_url":"https://api.github.com/users/lukaszbieniek/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaszbieniek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaszbieniek/subscriptions","organizations_url":"https://api.github.com/users/lukaszbieniek/orgs","repos_url":"https://api.github.com/users/lukaszbieniek/repos","events_url":"https://api.github.com/users/lukaszbieniek/events{/privacy}","received_events_url":"https://api.github.com/users/lukaszbieniek/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-05T13:54:55Z","updated_at":"2016-04-05T18:02:12Z","closed_at":null,"body":"Predicate `number?` used inside `each` macro causes `TypeError` while calling `#messages` method. Here's how to reproduce an error:\r\n\r\n**Fails for** `:number?`\r\n\r\n```ruby\r\nFailureWithNumberSchema = Dry::Validation.Schema do\r\n  key(:items).each do\r\n    key(:value).required(:number?)\r\n  end\r\nend\r\n\r\nFailureWithNumberSchema.call({}).messages\r\n# => TypeError: no implicit conversion of Hash into Array\r\n```\r\n\r\n**Works well with** `:str?`\r\n\r\n```ruby\r\nSuccessWithStringSchema = Dry::Validation.Schema do\r\n  key(:items).each do\r\n    key(:value).required(:str?)\r\n  end\r\nend\r\n\r\nSuccessWithStringSchema.call({}).messages\r\n# => {:items=>[\"is missing\"]}\r\n```"},"comment":{"url":"https://api.github.com/repos/dry-rb/dry-validation/issues/comments/205922246","html_url":"https://github.com/dry-rb/dry-validation/issues/95#issuecomment-205922246","issue_url":"https://api.github.com/repos/dry-rb/dry-validation/issues/95","id":205922246,"user":{"login":"solnic","id":1066,"avatar_url":"https://avatars.githubusercontent.com/u/1066?v=3","gravatar_id":"","url":"https://api.github.com/users/solnic","html_url":"https://github.com/solnic","followers_url":"https://api.github.com/users/solnic/followers","following_url":"https://api.github.com/users/solnic/following{/other_user}","gists_url":"https://api.github.com/users/solnic/gists{/gist_id}","starred_url":"https://api.github.com/users/solnic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solnic/subscriptions","organizations_url":"https://api.github.com/users/solnic/orgs","repos_url":"https://api.github.com/users/solnic/repos","events_url":"https://api.github.com/users/solnic/events{/privacy}","received_events_url":"https://api.github.com/users/solnic/received_events","type":"User","site_admin":false},"created_at":"2016-04-05T18:02:12Z","updated_at":"2016-04-05T18:02:12Z","body":"Please use a nested schema syntax with `each` too. Nested keys will be removed prior 1.0. So just do:\r\n\r\n``` ruby\r\nkey(:items).each do\r\n  schema do\r\n    key(:value).required(:number?)\r\n  end\r\nend\r\n```"}}