{"action":"created","issue":{"url":"https://api.github.com/repos/dry-rb/dry-validation/issues/288","repository_url":"https://api.github.com/repos/dry-rb/dry-validation","labels_url":"https://api.github.com/repos/dry-rb/dry-validation/issues/288/labels{/name}","comments_url":"https://api.github.com/repos/dry-rb/dry-validation/issues/288/comments","events_url":"https://api.github.com/repos/dry-rb/dry-validation/issues/288/events","html_url":"https://github.com/dry-rb/dry-validation/issues/288","id":195080786,"number":288,"title":"maybe(:array?) seems to neutralize every nested rule ","user":{"login":"ptolts","id":723514,"avatar_url":"https://avatars.githubusercontent.com/u/723514?v=3","gravatar_id":"","url":"https://api.github.com/users/ptolts","html_url":"https://github.com/ptolts","followers_url":"https://api.github.com/users/ptolts/followers","following_url":"https://api.github.com/users/ptolts/following{/other_user}","gists_url":"https://api.github.com/users/ptolts/gists{/gist_id}","starred_url":"https://api.github.com/users/ptolts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ptolts/subscriptions","organizations_url":"https://api.github.com/users/ptolts/orgs","repos_url":"https://api.github.com/users/ptolts/repos","events_url":"https://api.github.com/users/ptolts/events{/privacy}","received_events_url":"https://api.github.com/users/ptolts/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-12T20:45:09Z","updated_at":"2016-12-12T22:27:13Z","closed_at":"2016-12-12T22:27:13Z","body":"```\r\nschema = Dry::Validation.Form do\r\n  optional(:line_items).maybe(:array?).each do\r\n    schema do\r\n      optional(:variant_id).maybe(:int?)\r\n      optional(:quantity).maybe(:int?)\r\n    end\r\n  end\r\nend\r\n\r\nputs schema.call(line_items: [{ variant_id: 1, quantity: 'invalid_quantity' }]).inspect\r\n\r\n#<Dry::Validation::Result output={:line_items=>[{:variant_id=>1, :quantity=>\"invalid_quantity\"}]} errors={}>\r\n```\r\n\r\nSeems to function as I intended when I remove the `maybe(:array?)`, but it should probably work both ways, or blow up."},"comment":{"url":"https://api.github.com/repos/dry-rb/dry-validation/issues/comments/266573200","html_url":"https://github.com/dry-rb/dry-validation/issues/288#issuecomment-266573200","issue_url":"https://api.github.com/repos/dry-rb/dry-validation/issues/288","id":266573200,"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-12-12T22:27:13Z","updated_at":"2016-12-12T22:27:13Z","body":"you want this:\r\n\r\n```\r\nschema = Dry::Validation.Form do\r\n  optional(:line_items).maybe do\r\n    each do\r\n      schema do\r\n        optional(:variant_id).maybe(:int?)\r\n        optional(:quantity).maybe(:int?)\r\n      end\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nThis is because chaining is not supported, also `each` automatically adds `array?` check for you, although that's too implicit, so I'll be changing that before 1.0.0. Chaining might be supported later, not sure yet, if it turns out to be too hard I'll just make it raise an error when somebody tries to chain."}}
{"actor":{"display_login":"solnic"}}