{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/validation/issues/20","labels_url":"https://api.github.com/repos/aurelia/validation/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/validation/issues/20/comments","events_url":"https://api.github.com/repos/aurelia/validation/issues/20/events","html_url":"https://github.com/aurelia/validation/issues/20","id":64616135,"number":20,"title":"API is inconsistent","user":{"login":"janvanderhaegen","id":3787769,"avatar_url":"https://avatars.githubusercontent.com/u/3787769?v=3","gravatar_id":"","url":"https://api.github.com/users/janvanderhaegen","html_url":"https://github.com/janvanderhaegen","followers_url":"https://api.github.com/users/janvanderhaegen/followers","following_url":"https://api.github.com/users/janvanderhaegen/following{/other_user}","gists_url":"https://api.github.com/users/janvanderhaegen/gists{/gist_id}","starred_url":"https://api.github.com/users/janvanderhaegen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janvanderhaegen/subscriptions","organizations_url":"https://api.github.com/users/janvanderhaegen/orgs","repos_url":"https://api.github.com/users/janvanderhaegen/repos","events_url":"https://api.github.com/users/janvanderhaegen/events{/privacy}","received_events_url":"https://api.github.com/users/janvanderhaegen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aurelia/validation/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-26T19:38:07Z","updated_at":"2015-03-28T17:35:32Z","closed_at":null,"body":"The API currently asks some validation rules to be added using functions prefixed by 'is':\r\n- isStrongPassword()\r\n- isAlphanumeric()\r\n- ...\r\n\r\nThis is inconsistent with the more 'verb-less' validation rules:\r\n- email()\r\n- minLength()\r\n- notEmpty()\r\n\r\nTODO: decide on most desired API, then refactor so that they are consistent:\r\n```javascript\r\nthis.validation = validation.on(this)\r\n  .ensure('user.email').email()\r\n  .ensure('user.password').strongPassword();\r\n\r\nthis.validation = validation.on(this) \r\n  .ensure('user.email').isEmail()\r\n  .ensure('user.password').isStrongPassword();\r\n```\r\n\r\nPersonally I'd prefer the latter: having a 'verb' in each function that indicates a validation rule being executed. This is longer but \r\n- reads more like fluent English in combination with the preceding 'ensure'\r\n- is consistent with verbs in the functions '[passes(customFunction)](https://github.com/aurelia/validation/blob/master/doc/Intro.md#passescustomfunction-threshold)', '[passesRule(validationRule)](https://github.com/aurelia/validation/blob/master/doc/Intro.md#passesrulevalidationrule)' \r\n- shows the contrast with logical operators such as '[if(conditionalExpression)](https://github.com/aurelia/validation/blob/master/doc/Intro.md#ifconditionalexpression)' and '[switch(conditionalExpression)](https://github.com/aurelia/validation/blob/master/doc/Intro.md#switchconditionalexpression)'\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aurelia/validation/issues/comments/87271929","html_url":"https://github.com/aurelia/validation/issues/20#issuecomment-87271929","issue_url":"https://api.github.com/repos/aurelia/validation/issues/20","id":87271929,"user":{"login":"bryanrsmith","id":186704,"avatar_url":"https://avatars.githubusercontent.com/u/186704?v=3","gravatar_id":"","url":"https://api.github.com/users/bryanrsmith","html_url":"https://github.com/bryanrsmith","followers_url":"https://api.github.com/users/bryanrsmith/followers","following_url":"https://api.github.com/users/bryanrsmith/following{/other_user}","gists_url":"https://api.github.com/users/bryanrsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanrsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanrsmith/subscriptions","organizations_url":"https://api.github.com/users/bryanrsmith/orgs","repos_url":"https://api.github.com/users/bryanrsmith/repos","events_url":"https://api.github.com/users/bryanrsmith/events{/privacy}","received_events_url":"https://api.github.com/users/bryanrsmith/received_events","type":"User","site_admin":false},"created_at":"2015-03-28T17:35:32Z","updated_at":"2015-03-28T17:35:32Z","body":"+1 for verb-based. It makes the API read more fluently, which looks like what you're going for with the API."}}