{"action":"created","issue":{"url":"https://api.github.com/repos/finagle/finch/issues/164","labels_url":"https://api.github.com/repos/finagle/finch/issues/164/labels{/name}","comments_url":"https://api.github.com/repos/finagle/finch/issues/164/comments","events_url":"https://api.github.com/repos/finagle/finch/issues/164/events","html_url":"https://github.com/finagle/finch/issues/164","id":56286053,"number":164,"title":"Add predefined validation rules for common cases","user":{"login":"vkostyukov","id":1098539,"avatar_url":"https://avatars.githubusercontent.com/u/1098539?v=3","gravatar_id":"","url":"https://api.github.com/users/vkostyukov","html_url":"https://github.com/vkostyukov","followers_url":"https://api.github.com/users/vkostyukov/followers","following_url":"https://api.github.com/users/vkostyukov/following{/other_user}","gists_url":"https://api.github.com/users/vkostyukov/gists{/gist_id}","starred_url":"https://api.github.com/users/vkostyukov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkostyukov/subscriptions","organizations_url":"https://api.github.com/users/vkostyukov/orgs","repos_url":"https://api.github.com/users/vkostyukov/repos","events_url":"https://api.github.com/users/vkostyukov/events{/privacy}","received_events_url":"https://api.github.com/users/vkostyukov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/finagle/finch/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/finagle/finch/labels/feature","name":"feature","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/finagle/finch/milestones/5","labels_url":"https://api.github.com/repos/finagle/finch/milestones/5/labels","id":905235,"number":5,"title":"Finch 0.5.0","description":"","creator":{"login":"vkostyukov","id":1098539,"avatar_url":"https://avatars.githubusercontent.com/u/1098539?v=3","gravatar_id":"","url":"https://api.github.com/users/vkostyukov","html_url":"https://github.com/vkostyukov","followers_url":"https://api.github.com/users/vkostyukov/followers","following_url":"https://api.github.com/users/vkostyukov/following{/other_user}","gists_url":"https://api.github.com/users/vkostyukov/gists{/gist_id}","starred_url":"https://api.github.com/users/vkostyukov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkostyukov/subscriptions","organizations_url":"https://api.github.com/users/vkostyukov/orgs","repos_url":"https://api.github.com/users/vkostyukov/repos","events_url":"https://api.github.com/users/vkostyukov/events{/privacy}","received_events_url":"https://api.github.com/users/vkostyukov/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":8,"state":"open","created_at":"2014-12-16T06:31:58Z","updated_at":"2015-02-03T19:45:51Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-02-02T20:06:55Z","updated_at":"2015-02-04T09:44:24Z","closed_at":null,"body":"The following list looks like a good start:\r\n\r\n```scala\r\nBePositive\r\nBeNegative\r\nBeEmpty // for strings\r\nBeZero // for numbers\r\nBeLongerThan // for strings\r\nBeShorterThan // for string\r\nBeLessThan // for numbers\r\nBeGreaterThat // for number\r\n```"},"comment":{"url":"https://api.github.com/repos/finagle/finch/issues/comments/72826144","html_url":"https://github.com/finagle/finch/issues/164#issuecomment-72826144","issue_url":"https://api.github.com/repos/finagle/finch/issues/164","id":72826144,"user":{"login":"jenshalm","id":3116929,"avatar_url":"https://avatars.githubusercontent.com/u/3116929?v=3","gravatar_id":"","url":"https://api.github.com/users/jenshalm","html_url":"https://github.com/jenshalm","followers_url":"https://api.github.com/users/jenshalm/followers","following_url":"https://api.github.com/users/jenshalm/following{/other_user}","gists_url":"https://api.github.com/users/jenshalm/gists{/gist_id}","starred_url":"https://api.github.com/users/jenshalm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenshalm/subscriptions","organizations_url":"https://api.github.com/users/jenshalm/orgs","repos_url":"https://api.github.com/users/jenshalm/repos","events_url":"https://api.github.com/users/jenshalm/events{/privacy}","received_events_url":"https://api.github.com/users/jenshalm/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T09:44:24Z","updated_at":"2015-02-04T09:44:24Z","body":"Wouldn't it read better with lowercase: `should(beEven)`. I think it will be more lightweight to implement these rules with `val`s and `def`s, not with `object`s like the readers.\r\n\r\nThe convenience for optional values is already covered for reusable rules, through an implicit conversion. It would be nice to also cover it for inline rules, but I did not have a good idea yet. I think it would require at least an inline type annotation, to trigger the implicit conversion from `A => Boolean` to `Option[A] => Boolean`.\r\n\r\nI don't have time to try this right now, but my gut feeling is you'd end up writing this:\r\n```scala\r\nval a = OptionalParam(\"a\").as[Int].should(\"be equal 100\") { i: Int => i == 100 }\r\n```\r\n"}}