{"action":"opened","number":212,"pull_request":{"url":"https://api.github.com/repos/ctavan/express-validator/pulls/212","id":61821552,"html_url":"https://github.com/ctavan/express-validator/pull/212","diff_url":"https://github.com/ctavan/express-validator/pull/212.diff","patch_url":"https://github.com/ctavan/express-validator/pull/212.patch","issue_url":"https://api.github.com/repos/ctavan/express-validator/issues/212","number":212,"state":"open","locked":false,"title":"#203 - Fixed bug where .withMessage() would not apply to a custom async validator","user":{"login":"chrissinclair","id":1311462,"avatar_url":"https://avatars.githubusercontent.com/u/1311462?v=3","gravatar_id":"","url":"https://api.github.com/users/chrissinclair","html_url":"https://github.com/chrissinclair","followers_url":"https://api.github.com/users/chrissinclair/followers","following_url":"https://api.github.com/users/chrissinclair/following{/other_user}","gists_url":"https://api.github.com/users/chrissinclair/gists{/gist_id}","starred_url":"https://api.github.com/users/chrissinclair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrissinclair/subscriptions","organizations_url":"https://api.github.com/users/chrissinclair/orgs","repos_url":"https://api.github.com/users/chrissinclair/repos","events_url":"https://api.github.com/users/chrissinclair/events{/privacy}","received_events_url":"https://api.github.com/users/chrissinclair/received_events","type":"User","site_admin":false},"body":"The idea here is to use the async parallel of how `withMessage()` works in the synchronous case. We expand `lastError` to include a flag indicating whether the validator is async, and if so pop the promise from `_asyncValidationErrors` and replace it with one that resolves to the provided message. \r\n\r\nAs we have already attached a handler to the promise coming from the custom validator, we have to route the existing one to an empty catch handler, otherwise bluebird will throw an 'unhandled rejection' error. ","created_at":"2016-03-05T19:34:08Z","updated_at":"2016-03-05T19:34:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ctavan/express-validator/pulls/212/commits","review_comments_url":"https://api.github.com/repos/ctavan/express-validator/pulls/212/comments","review_comment_url":"https://api.github.com/repos/ctavan/express-validator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ctavan/express-validator/issues/212/comments","statuses_url":"https://api.github.com/repos/ctavan/express-validator/statuses/f6f88bcfd69179f2fdae87c02903bc04eba92029","head":{"label":"chrissinclair:master","ref":"master","sha":"f6f88bcfd69179f2fdae87c02903bc04eba92029","user":{"login":"chrissinclair","id":1311462,"avatar_url":"https://avatars.githubusercontent.com/u/1311462?v=3","gravatar_id":"","url":"https://api.github.com/users/chrissinclair","html_url":"https://github.com/chrissinclair","followers_url":"https://api.github.com/users/chrissinclair/followers","following_url":"https://api.github.com/users/chrissinclair/following{/other_user}","gists_url":"https://api.github.com/users/chrissinclair/gists{/gist_id}","starred_url":"https://api.github.com/users/chrissinclair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrissinclair/subscriptions","organizations_url":"https://api.github.com/users/chrissinclair/orgs","repos_url":"https://api.github.com/users/chrissinclair/repos","events_url":"https://api.github.com/users/chrissinclair/events{/privacy}","received_events_url":"https://api.github.com/users/chrissinclair/received_events","type":"User","site_admin":false},"repo":{"id":53197596,"name":"express-validator","full_name":"chrissinclair/express-validator","owner":{"login":"chrissinclair","id":1311462,"avatar_url":"https://avatars.githubusercontent.com/u/1311462?v=3","gravatar_id":"","url":"https://api.github.com/users/chrissinclair","html_url":"https://github.com/chrissinclair","followers_url":"https://api.github.com/users/chrissinclair/followers","following_url":"https://api.github.com/users/chrissinclair/following{/other_user}","gists_url":"https://api.github.com/users/chrissinclair/gists{/gist_id}","starred_url":"https://api.github.com/users/chrissinclair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrissinclair/subscriptions","organizations_url":"https://api.github.com/users/chrissinclair/orgs","repos_url":"https://api.github.com/users/chrissinclair/repos","events_url":"https://api.github.com/users/chrissinclair/events{/privacy}","received_events_url":"https://api.github.com/users/chrissinclair/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chrissinclair/express-validator","description":"An express.js middleware for node-validator.","fork":true,"url":"https://api.github.com/repos/chrissinclair/express-validator","forks_url":"https://api.github.com/repos/chrissinclair/express-validator/forks","keys_url":"https://api.github.com/repos/chrissinclair/express-validator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chrissinclair/express-validator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chrissinclair/express-validator/teams","hooks_url":"https://api.github.com/repos/chrissinclair/express-validator/hooks","issue_events_url":"https://api.github.com/repos/chrissinclair/express-validator/issues/events{/number}","events_url":"https://api.github.com/repos/chrissinclair/express-validator/events","assignees_url":"https://api.github.com/repos/chrissinclair/express-validator/assignees{/user}","branches_url":"https://api.github.com/repos/chrissinclair/express-validator/branches{/branch}","tags_url":"https://api.github.com/repos/chrissinclair/express-validator/tags","blobs_url":"https://api.github.com/repos/chrissinclair/express-validator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chrissinclair/express-validator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chrissinclair/express-validator/git/refs{/sha}","trees_url":"https://api.github.com/repos/chrissinclair/express-validator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chrissinclair/express-validator/statuses/{sha}","languages_url":"https://api.github.com/repos/chrissinclair/express-validator/languages","stargazers_url":"https://api.github.com/repos/chrissinclair/express-validator/stargazers","contributors_url":"https://api.github.com/repos/chrissinclair/express-validator/contributors","subscribers_url":"https://api.github.com/repos/chrissinclair/express-validator/subscribers","subscription_url":"https://api.github.com/repos/chrissinclair/express-validator/subscription","commits_url":"https://api.github.com/repos/chrissinclair/express-validator/commits{/sha}","git_commits_url":"https://api.github.com/repos/chrissinclair/express-validator/git/commits{/sha}","comments_url":"https://api.github.com/repos/chrissinclair/express-validator/comments{/number}","issue_comment_url":"https://api.github.com/repos/chrissinclair/express-validator/issues/comments{/number}","contents_url":"https://api.github.com/repos/chrissinclair/express-validator/contents/{+path}","compare_url":"https://api.github.com/repos/chrissinclair/express-validator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chrissinclair/express-validator/merges","archive_url":"https://api.github.com/repos/chrissinclair/express-validator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chrissinclair/express-validator/downloads","issues_url":"https://api.github.com/repos/chrissinclair/express-validator/issues{/number}","pulls_url":"https://api.github.com/repos/chrissinclair/express-validator/pulls{/number}","milestones_url":"https://api.github.com/repos/chrissinclair/express-validator/milestones{/number}","notifications_url":"https://api.github.com/repos/chrissinclair/express-validator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chrissinclair/express-validator/labels{/name}","releases_url":"https://api.github.com/repos/chrissinclair/express-validator/releases{/id}","deployments_url":"https://api.github.com/repos/chrissinclair/express-validator/deployments","created_at":"2016-03-05T11:12:36Z","updated_at":"2016-03-05T11:12:38Z","pushed_at":"2016-03-05T19:04:03Z","git_url":"git://github.com/chrissinclair/express-validator.git","ssh_url":"git@github.com:chrissinclair/express-validator.git","clone_url":"https://github.com/chrissinclair/express-validator.git","svn_url":"https://github.com/chrissinclair/express-validator","homepage":"","size":209,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ctavan:master","ref":"master","sha":"f3ed152ef28bcc49d7c67c3842fb1ff1bb2067ed","user":{"login":"ctavan","id":508118,"avatar_url":"https://avatars.githubusercontent.com/u/508118?v=3","gravatar_id":"","url":"https://api.github.com/users/ctavan","html_url":"https://github.com/ctavan","followers_url":"https://api.github.com/users/ctavan/followers","following_url":"https://api.github.com/users/ctavan/following{/other_user}","gists_url":"https://api.github.com/users/ctavan/gists{/gist_id}","starred_url":"https://api.github.com/users/ctavan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctavan/subscriptions","organizations_url":"https://api.github.com/users/ctavan/orgs","repos_url":"https://api.github.com/users/ctavan/repos","events_url":"https://api.github.com/users/ctavan/events{/privacy}","received_events_url":"https://api.github.com/users/ctavan/received_events","type":"User","site_admin":false},"repo":{"id":2518028,"name":"express-validator","full_name":"ctavan/express-validator","owner":{"login":"ctavan","id":508118,"avatar_url":"https://avatars.githubusercontent.com/u/508118?v=3","gravatar_id":"","url":"https://api.github.com/users/ctavan","html_url":"https://github.com/ctavan","followers_url":"https://api.github.com/users/ctavan/followers","following_url":"https://api.github.com/users/ctavan/following{/other_user}","gists_url":"https://api.github.com/users/ctavan/gists{/gist_id}","starred_url":"https://api.github.com/users/ctavan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctavan/subscriptions","organizations_url":"https://api.github.com/users/ctavan/orgs","repos_url":"https://api.github.com/users/ctavan/repos","events_url":"https://api.github.com/users/ctavan/events{/privacy}","received_events_url":"https://api.github.com/users/ctavan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ctavan/express-validator","description":"An express.js middleware for node-validator.","fork":false,"url":"https://api.github.com/repos/ctavan/express-validator","forks_url":"https://api.github.com/repos/ctavan/express-validator/forks","keys_url":"https://api.github.com/repos/ctavan/express-validator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ctavan/express-validator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ctavan/express-validator/teams","hooks_url":"https://api.github.com/repos/ctavan/express-validator/hooks","issue_events_url":"https://api.github.com/repos/ctavan/express-validator/issues/events{/number}","events_url":"https://api.github.com/repos/ctavan/express-validator/events","assignees_url":"https://api.github.com/repos/ctavan/express-validator/assignees{/user}","branches_url":"https://api.github.com/repos/ctavan/express-validator/branches{/branch}","tags_url":"https://api.github.com/repos/ctavan/express-validator/tags","blobs_url":"https://api.github.com/repos/ctavan/express-validator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ctavan/express-validator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ctavan/express-validator/git/refs{/sha}","trees_url":"https://api.github.com/repos/ctavan/express-validator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ctavan/express-validator/statuses/{sha}","languages_url":"https://api.github.com/repos/ctavan/express-validator/languages","stargazers_url":"https://api.github.com/repos/ctavan/express-validator/stargazers","contributors_url":"https://api.github.com/repos/ctavan/express-validator/contributors","subscribers_url":"https://api.github.com/repos/ctavan/express-validator/subscribers","subscription_url":"https://api.github.com/repos/ctavan/express-validator/subscription","commits_url":"https://api.github.com/repos/ctavan/express-validator/commits{/sha}","git_commits_url":"https://api.github.com/repos/ctavan/express-validator/git/commits{/sha}","comments_url":"https://api.github.com/repos/ctavan/express-validator/comments{/number}","issue_comment_url":"https://api.github.com/repos/ctavan/express-validator/issues/comments{/number}","contents_url":"https://api.github.com/repos/ctavan/express-validator/contents/{+path}","compare_url":"https://api.github.com/repos/ctavan/express-validator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ctavan/express-validator/merges","archive_url":"https://api.github.com/repos/ctavan/express-validator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ctavan/express-validator/downloads","issues_url":"https://api.github.com/repos/ctavan/express-validator/issues{/number}","pulls_url":"https://api.github.com/repos/ctavan/express-validator/pulls{/number}","milestones_url":"https://api.github.com/repos/ctavan/express-validator/milestones{/number}","notifications_url":"https://api.github.com/repos/ctavan/express-validator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ctavan/express-validator/labels{/name}","releases_url":"https://api.github.com/repos/ctavan/express-validator/releases{/id}","deployments_url":"https://api.github.com/repos/ctavan/express-validator/deployments","created_at":"2011-10-05T09:32:19Z","updated_at":"2016-03-05T07:51:50Z","pushed_at":"2016-02-24T09:51:26Z","git_url":"git://github.com/ctavan/express-validator.git","ssh_url":"git@github.com:ctavan/express-validator.git","clone_url":"https://github.com/ctavan/express-validator.git","svn_url":"https://github.com/ctavan/express-validator","homepage":"","size":704,"stargazers_count":1128,"watchers_count":1128,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":159,"mirror_url":null,"open_issues_count":23,"forks":159,"open_issues":23,"watchers":1128,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ctavan/express-validator/pulls/212"},"html":{"href":"https://github.com/ctavan/express-validator/pull/212"},"issue":{"href":"https://api.github.com/repos/ctavan/express-validator/issues/212"},"comments":{"href":"https://api.github.com/repos/ctavan/express-validator/issues/212/comments"},"review_comments":{"href":"https://api.github.com/repos/ctavan/express-validator/pulls/212/comments"},"review_comment":{"href":"https://api.github.com/repos/ctavan/express-validator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ctavan/express-validator/pulls/212/commits"},"statuses":{"href":"https://api.github.com/repos/ctavan/express-validator/statuses/f6f88bcfd69179f2fdae87c02903bc04eba92029"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":170,"deletions":12,"changed_files":2}}