{"action":"opened","number":283,"pull_request":{"url":"https://api.github.com/repos/thedersen/backbone.validation/pulls/283","id":32083441,"html_url":"https://github.com/thedersen/backbone.validation/pull/283","diff_url":"https://github.com/thedersen/backbone.validation/pull/283.diff","patch_url":"https://github.com/thedersen/backbone.validation/pull/283.patch","issue_url":"https://api.github.com/repos/thedersen/backbone.validation/issues/283","number":283,"state":"open","locked":false,"title":"Bind with label formatter","user":{"login":"platinumazure","id":284282,"avatar_url":"https://avatars.githubusercontent.com/u/284282?v=3","gravatar_id":"","url":"https://api.github.com/users/platinumazure","html_url":"https://github.com/platinumazure","followers_url":"https://api.github.com/users/platinumazure/followers","following_url":"https://api.github.com/users/platinumazure/following{/other_user}","gists_url":"https://api.github.com/users/platinumazure/gists{/gist_id}","starred_url":"https://api.github.com/users/platinumazure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/platinumazure/subscriptions","organizations_url":"https://api.github.com/users/platinumazure/orgs","repos_url":"https://api.github.com/users/platinumazure/repos","events_url":"https://api.github.com/users/platinumazure/events{/privacy}","received_events_url":"https://api.github.com/users/platinumazure/received_events","type":"User","site_admin":false},"body":"One approach for fixing #282.\r\n\r\nI had two basic approaches in mind for fixing this issue. One was to pass `options` down into each validator and ensure that the options are passed into `formatLabel`. This seemed too large of an impact and any custom or method validators which call default validators would have to remember to pass the `options` along to have any effect.\r\n\r\nThe second approach, and what I used here, was to add `{ options: options }` to the context object used to call each validator. This worked like a charm and avoided a lot of validator modification; however, it turns out that the `_.bind` call (to bind default validators to a context object containing formatFunctions and defaultValidators) was interfering with this plan. I had to remove `_.bind` but write equivalent code (which looks for `this === defaultValidators` and replaces the context in that case only) to avoid problems. All tests are passing and #282 is fixed for ordinary validator cases; however, validators which call other validators will still not have labelFormatter be respected unless the validator is invoked with the correct calling context:\r\n\r\n    return Backbone.Validation.validators.length.call(this, value, attr, 4);\r\n\r\nWithout `.call(this)`, functionality is no worse than it was (i.e., #282 is still broken in that case, but nothing else has regressed either). The assumption is that this is still a net improvement and that the validator-calling-validators case is broken more because of accumulated tech debt and questionable design decisions rather than because of major flaws in the implementation of this pull request.","created_at":"2015-03-27T04:59:01Z","updated_at":"2015-03-27T04:59:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thedersen/backbone.validation/pulls/283/commits","review_comments_url":"https://api.github.com/repos/thedersen/backbone.validation/pulls/283/comments","review_comment_url":"https://api.github.com/repos/thedersen/backbone.validation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thedersen/backbone.validation/issues/283/comments","statuses_url":"https://api.github.com/repos/thedersen/backbone.validation/statuses/5ce533018f0dc2393f34997f5565a3c678c1e6cd","head":{"label":"platinumazure:bind-with-labelFormatter","ref":"bind-with-labelFormatter","sha":"5ce533018f0dc2393f34997f5565a3c678c1e6cd","user":{"login":"platinumazure","id":284282,"avatar_url":"https://avatars.githubusercontent.com/u/284282?v=3","gravatar_id":"","url":"https://api.github.com/users/platinumazure","html_url":"https://github.com/platinumazure","followers_url":"https://api.github.com/users/platinumazure/followers","following_url":"https://api.github.com/users/platinumazure/following{/other_user}","gists_url":"https://api.github.com/users/platinumazure/gists{/gist_id}","starred_url":"https://api.github.com/users/platinumazure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/platinumazure/subscriptions","organizations_url":"https://api.github.com/users/platinumazure/orgs","repos_url":"https://api.github.com/users/platinumazure/repos","events_url":"https://api.github.com/users/platinumazure/events{/privacy}","received_events_url":"https://api.github.com/users/platinumazure/received_events","type":"User","site_admin":false},"repo":{"id":29801119,"name":"backbone.validation","full_name":"platinumazure/backbone.validation","owner":{"login":"platinumazure","id":284282,"avatar_url":"https://avatars.githubusercontent.com/u/284282?v=3","gravatar_id":"","url":"https://api.github.com/users/platinumazure","html_url":"https://github.com/platinumazure","followers_url":"https://api.github.com/users/platinumazure/followers","following_url":"https://api.github.com/users/platinumazure/following{/other_user}","gists_url":"https://api.github.com/users/platinumazure/gists{/gist_id}","starred_url":"https://api.github.com/users/platinumazure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/platinumazure/subscriptions","organizations_url":"https://api.github.com/users/platinumazure/orgs","repos_url":"https://api.github.com/users/platinumazure/repos","events_url":"https://api.github.com/users/platinumazure/events{/privacy}","received_events_url":"https://api.github.com/users/platinumazure/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/platinumazure/backbone.validation","description":"A validation plugin for Backbone.js that validates both your model as well as form input","fork":true,"url":"https://api.github.com/repos/platinumazure/backbone.validation","forks_url":"https://api.github.com/repos/platinumazure/backbone.validation/forks","keys_url":"https://api.github.com/repos/platinumazure/backbone.validation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/platinumazure/backbone.validation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/platinumazure/backbone.validation/teams","hooks_url":"https://api.github.com/repos/platinumazure/backbone.validation/hooks","issue_events_url":"https://api.github.com/repos/platinumazure/backbone.validation/issues/events{/number}","events_url":"https://api.github.com/repos/platinumazure/backbone.validation/events","assignees_url":"https://api.github.com/repos/platinumazure/backbone.validation/assignees{/user}","branches_url":"https://api.github.com/repos/platinumazure/backbone.validation/branches{/branch}","tags_url":"https://api.github.com/repos/platinumazure/backbone.validation/tags","blobs_url":"https://api.github.com/repos/platinumazure/backbone.validation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/platinumazure/backbone.validation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/platinumazure/backbone.validation/git/refs{/sha}","trees_url":"https://api.github.com/repos/platinumazure/backbone.validation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/platinumazure/backbone.validation/statuses/{sha}","languages_url":"https://api.github.com/repos/platinumazure/backbone.validation/languages","stargazers_url":"https://api.github.com/repos/platinumazure/backbone.validation/stargazers","contributors_url":"https://api.github.com/repos/platinumazure/backbone.validation/contributors","subscribers_url":"https://api.github.com/repos/platinumazure/backbone.validation/subscribers","subscription_url":"https://api.github.com/repos/platinumazure/backbone.validation/subscription","commits_url":"https://api.github.com/repos/platinumazure/backbone.validation/commits{/sha}","git_commits_url":"https://api.github.com/repos/platinumazure/backbone.validation/git/commits{/sha}","comments_url":"https://api.github.com/repos/platinumazure/backbone.validation/comments{/number}","issue_comment_url":"https://api.github.com/repos/platinumazure/backbone.validation/issues/comments{/number}","contents_url":"https://api.github.com/repos/platinumazure/backbone.validation/contents/{+path}","compare_url":"https://api.github.com/repos/platinumazure/backbone.validation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/platinumazure/backbone.validation/merges","archive_url":"https://api.github.com/repos/platinumazure/backbone.validation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/platinumazure/backbone.validation/downloads","issues_url":"https://api.github.com/repos/platinumazure/backbone.validation/issues{/number}","pulls_url":"https://api.github.com/repos/platinumazure/backbone.validation/pulls{/number}","milestones_url":"https://api.github.com/repos/platinumazure/backbone.validation/milestones{/number}","notifications_url":"https://api.github.com/repos/platinumazure/backbone.validation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/platinumazure/backbone.validation/labels{/name}","releases_url":"https://api.github.com/repos/platinumazure/backbone.validation/releases{/id}","created_at":"2015-01-25T03:24:17Z","updated_at":"2015-03-27T02:22:11Z","pushed_at":"2015-03-27T04:50:43Z","git_url":"git://github.com/platinumazure/backbone.validation.git","ssh_url":"git@github.com:platinumazure/backbone.validation.git","clone_url":"https://github.com/platinumazure/backbone.validation.git","svn_url":"https://github.com/platinumazure/backbone.validation","homepage":"thedersen.com/projects/backbone-validation","size":1181,"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":"thedersen:master","ref":"master","sha":"4e8add5646c0e431308e03feeb5b2e51f1c77222","user":{"login":"thedersen","id":131983,"avatar_url":"https://avatars.githubusercontent.com/u/131983?v=3","gravatar_id":"","url":"https://api.github.com/users/thedersen","html_url":"https://github.com/thedersen","followers_url":"https://api.github.com/users/thedersen/followers","following_url":"https://api.github.com/users/thedersen/following{/other_user}","gists_url":"https://api.github.com/users/thedersen/gists{/gist_id}","starred_url":"https://api.github.com/users/thedersen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thedersen/subscriptions","organizations_url":"https://api.github.com/users/thedersen/orgs","repos_url":"https://api.github.com/users/thedersen/repos","events_url":"https://api.github.com/users/thedersen/events{/privacy}","received_events_url":"https://api.github.com/users/thedersen/received_events","type":"User","site_admin":false},"repo":{"id":2456444,"name":"backbone.validation","full_name":"thedersen/backbone.validation","owner":{"login":"thedersen","id":131983,"avatar_url":"https://avatars.githubusercontent.com/u/131983?v=3","gravatar_id":"","url":"https://api.github.com/users/thedersen","html_url":"https://github.com/thedersen","followers_url":"https://api.github.com/users/thedersen/followers","following_url":"https://api.github.com/users/thedersen/following{/other_user}","gists_url":"https://api.github.com/users/thedersen/gists{/gist_id}","starred_url":"https://api.github.com/users/thedersen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thedersen/subscriptions","organizations_url":"https://api.github.com/users/thedersen/orgs","repos_url":"https://api.github.com/users/thedersen/repos","events_url":"https://api.github.com/users/thedersen/events{/privacy}","received_events_url":"https://api.github.com/users/thedersen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thedersen/backbone.validation","description":"A validation plugin for Backbone.js that validates both your model as well as form input","fork":false,"url":"https://api.github.com/repos/thedersen/backbone.validation","forks_url":"https://api.github.com/repos/thedersen/backbone.validation/forks","keys_url":"https://api.github.com/repos/thedersen/backbone.validation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thedersen/backbone.validation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thedersen/backbone.validation/teams","hooks_url":"https://api.github.com/repos/thedersen/backbone.validation/hooks","issue_events_url":"https://api.github.com/repos/thedersen/backbone.validation/issues/events{/number}","events_url":"https://api.github.com/repos/thedersen/backbone.validation/events","assignees_url":"https://api.github.com/repos/thedersen/backbone.validation/assignees{/user}","branches_url":"https://api.github.com/repos/thedersen/backbone.validation/branches{/branch}","tags_url":"https://api.github.com/repos/thedersen/backbone.validation/tags","blobs_url":"https://api.github.com/repos/thedersen/backbone.validation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thedersen/backbone.validation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thedersen/backbone.validation/git/refs{/sha}","trees_url":"https://api.github.com/repos/thedersen/backbone.validation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thedersen/backbone.validation/statuses/{sha}","languages_url":"https://api.github.com/repos/thedersen/backbone.validation/languages","stargazers_url":"https://api.github.com/repos/thedersen/backbone.validation/stargazers","contributors_url":"https://api.github.com/repos/thedersen/backbone.validation/contributors","subscribers_url":"https://api.github.com/repos/thedersen/backbone.validation/subscribers","subscription_url":"https://api.github.com/repos/thedersen/backbone.validation/subscription","commits_url":"https://api.github.com/repos/thedersen/backbone.validation/commits{/sha}","git_commits_url":"https://api.github.com/repos/thedersen/backbone.validation/git/commits{/sha}","comments_url":"https://api.github.com/repos/thedersen/backbone.validation/comments{/number}","issue_comment_url":"https://api.github.com/repos/thedersen/backbone.validation/issues/comments{/number}","contents_url":"https://api.github.com/repos/thedersen/backbone.validation/contents/{+path}","compare_url":"https://api.github.com/repos/thedersen/backbone.validation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thedersen/backbone.validation/merges","archive_url":"https://api.github.com/repos/thedersen/backbone.validation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thedersen/backbone.validation/downloads","issues_url":"https://api.github.com/repos/thedersen/backbone.validation/issues{/number}","pulls_url":"https://api.github.com/repos/thedersen/backbone.validation/pulls{/number}","milestones_url":"https://api.github.com/repos/thedersen/backbone.validation/milestones{/number}","notifications_url":"https://api.github.com/repos/thedersen/backbone.validation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thedersen/backbone.validation/labels{/name}","releases_url":"https://api.github.com/repos/thedersen/backbone.validation/releases{/id}","created_at":"2011-09-25T20:33:43Z","updated_at":"2015-03-27T01:16:35Z","pushed_at":"2015-03-17T21:25:19Z","git_url":"git://github.com/thedersen/backbone.validation.git","ssh_url":"git@github.com:thedersen/backbone.validation.git","clone_url":"https://github.com/thedersen/backbone.validation.git","svn_url":"https://github.com/thedersen/backbone.validation","homepage":"thedersen.com/projects/backbone-validation","size":2514,"stargazers_count":1193,"watchers_count":1193,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":256,"mirror_url":null,"open_issues_count":52,"forks":256,"open_issues":52,"watchers":1193,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thedersen/backbone.validation/pulls/283"},"html":{"href":"https://github.com/thedersen/backbone.validation/pull/283"},"issue":{"href":"https://api.github.com/repos/thedersen/backbone.validation/issues/283"},"comments":{"href":"https://api.github.com/repos/thedersen/backbone.validation/issues/283/comments"},"review_comments":{"href":"https://api.github.com/repos/thedersen/backbone.validation/pulls/283/comments"},"review_comment":{"href":"https://api.github.com/repos/thedersen/backbone.validation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thedersen/backbone.validation/pulls/283/commits"},"statuses":{"href":"https://api.github.com/repos/thedersen/backbone.validation/statuses/5ce533018f0dc2393f34997f5565a3c678c1e6cd"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":2,"additions":71,"deletions":14,"changed_files":2}}