{"action":"created","comment":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/comments/68770702","id":68770702,"diff_hunk":"@@ -239,6 +253,20 @@ exports.valObjects = {\n             }\n \n             propOut.set(vOut);\n+        },\n+        validateFunction: function(v, opts) {\n+            if(!Array.isArray(v)) return false;\n+\n+            var items = opts.items;\n+\n+            // valid when one item is valid (which is subject to debate)","path":"src/lib/coerce.js","position":71,"original_position":71,"commit_id":"1958dc6d5a2dce11b2400360e6fe1762c6c30269","original_commit_id":"1958dc6d5a2dce11b2400360e6fe1762c6c30269","user":{"login":"mdtusz","id":6494463,"avatar_url":"https://avatars.githubusercontent.com/u/6494463?v=3","gravatar_id":"","url":"https://api.github.com/users/mdtusz","html_url":"https://github.com/mdtusz","followers_url":"https://api.github.com/users/mdtusz/followers","following_url":"https://api.github.com/users/mdtusz/following{/other_user}","gists_url":"https://api.github.com/users/mdtusz/gists{/gist_id}","starred_url":"https://api.github.com/users/mdtusz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdtusz/subscriptions","organizations_url":"https://api.github.com/users/mdtusz/orgs","repos_url":"https://api.github.com/users/mdtusz/repos","events_url":"https://api.github.com/users/mdtusz/events{/privacy}","received_events_url":"https://api.github.com/users/mdtusz/received_events","type":"User","site_admin":false},"body":"I'd vote for being strict here (unless there's a reason otherwise).","created_at":"2016-06-28T14:43:09Z","updated_at":"2016-06-28T14:43:09Z","html_url":"https://github.com/plotly/plotly.js/pull/697#discussion_r68770702","pull_request_url":"https://api.github.com/repos/plotly/plotly.js/pulls/697","_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/comments/68770702"},"html":{"href":"https://github.com/plotly/plotly.js/pull/697#discussion_r68770702"},"pull_request":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/697"}}},"pull_request":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/697","id":75398801,"html_url":"https://github.com/plotly/plotly.js/pull/697","diff_url":"https://github.com/plotly/plotly.js/pull/697.diff","patch_url":"https://github.com/plotly/plotly.js/pull/697.patch","issue_url":"https://api.github.com/repos/plotly/plotly.js/issues/697","number":697,"state":"open","locked":false,"title":"Introducing Plotly.validate(data, layout)","user":{"login":"etpinard","id":6675409,"avatar_url":"https://avatars.githubusercontent.com/u/6675409?v=3","gravatar_id":"","url":"https://api.github.com/users/etpinard","html_url":"https://github.com/etpinard","followers_url":"https://api.github.com/users/etpinard/followers","following_url":"https://api.github.com/users/etpinard/following{/other_user}","gists_url":"https://api.github.com/users/etpinard/gists{/gist_id}","starred_url":"https://api.github.com/users/etpinard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etpinard/subscriptions","organizations_url":"https://api.github.com/users/etpinard/orgs","repos_url":"https://api.github.com/users/etpinard/repos","events_url":"https://api.github.com/users/etpinard/events{/privacy}","received_events_url":"https://api.github.com/users/etpinard/received_events","type":"User","site_admin":false},"body":"resolves https://github.com/plotly/plotly.js/issues/598\r\n\r\nbased off [`plotly-validate`](https://github.com/plotly/plotly.js/compare/plotly-validate) and [`lib-validate`](https://github.com/plotly/plotly.js/compare/lib-validate).\r\n\r\n### Example\r\n\r\n```js\r\nvar data = [{\r\n  type: 'bar',\r\n  y: [2, 1, 2],\r\n  orientation: 'horizontal'\r\n}];\r\n\r\nvar out = Plotly.validate(data, {});\r\n\r\nconsole.log(out.data[0][0].msg));\r\n// \"key orientation is set to an invalid value (horizontal)\"\r\n```\r\n\r\n### In brief\r\n\r\nThis PR expose a top-level method allowing users to validate their input `data` and `layout`. \r\n\r\n`Plotly.validate` calls `Plots.supplyDefaults` and `PlotSchema.get` and a new [`Lib.validate`](https://github.com/plotly/plotly.js/commit/e94eec31ca160e29f221fdcd5d1f048f1b8cb117) method internally to determine if:\r\n\r\n- a trace was made `visible = false` by an invalid set of attributes\r\n- a key was found in a trace or layout object that is not part of the plot schema\r\n- a key was found in user input but isn't used in the plotting code (i.e. the key isn't found `fullData` or `fullLayout` )\r\n- a value in invalid\r\n\r\n\r\n### Some remaining questions\r\n\r\n- [ ] How to handle non-array `data` and non-object `layout` input? Error out?, Output with different other error code?\r\n- [ ] When no validate errors found, should `Plotly.validate` return `true`? More generally, should `Plotly.validate` always return the a `{ data: [], layout: [] }` object?\r\n\r\n\r\n","created_at":"2016-06-27T23:54:35Z","updated_at":"2016-06-28T14:43:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f9e5fed2368e29ba4fedc49d6c64a0f620ab939","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/plotly/plotly.js/pulls/697/commits","review_comments_url":"https://api.github.com/repos/plotly/plotly.js/pulls/697/comments","review_comment_url":"https://api.github.com/repos/plotly/plotly.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/plotly/plotly.js/issues/697/comments","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/1958dc6d5a2dce11b2400360e6fe1762c6c30269","head":{"label":"plotly:validate","ref":"validate","sha":"1958dc6d5a2dce11b2400360e6fe1762c6c30269","user":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":45646037,"name":"plotly.js","full_name":"plotly/plotly.js","owner":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.js","description":"The open source javascript graphing library that powers plotly","fork":false,"url":"https://api.github.com/repos/plotly/plotly.js","forks_url":"https://api.github.com/repos/plotly/plotly.js/forks","keys_url":"https://api.github.com/repos/plotly/plotly.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.js/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.js/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.js/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.js/events","assignees_url":"https://api.github.com/repos/plotly/plotly.js/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.js/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.js/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.js/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.js/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.js/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.js/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.js/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.js/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.js/merges","archive_url":"https://api.github.com/repos/plotly/plotly.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.js/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.js/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.js/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.js/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.js/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.js/releases{/id}","deployments_url":"https://api.github.com/repos/plotly/plotly.js/deployments","created_at":"2015-11-05T23:27:17Z","updated_at":"2016-06-28T12:33:13Z","pushed_at":"2016-06-28T14:08:30Z","git_url":"git://github.com/plotly/plotly.js.git","ssh_url":"git@github.com:plotly/plotly.js.git","clone_url":"https://github.com/plotly/plotly.js.git","svn_url":"https://github.com/plotly/plotly.js","homepage":"https://plot.ly/javascript/","size":117979,"stargazers_count":4890,"watchers_count":4890,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":401,"mirror_url":null,"open_issues_count":165,"forks":401,"open_issues":165,"watchers":4890,"default_branch":"master"}},"base":{"label":"plotly:master","ref":"master","sha":"9dba590ff119dfd531bcb9ed42e5e802f98038a7","user":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":45646037,"name":"plotly.js","full_name":"plotly/plotly.js","owner":{"login":"plotly","id":5997976,"avatar_url":"https://avatars.githubusercontent.com/u/5997976?v=3","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.js","description":"The open source javascript graphing library that powers plotly","fork":false,"url":"https://api.github.com/repos/plotly/plotly.js","forks_url":"https://api.github.com/repos/plotly/plotly.js/forks","keys_url":"https://api.github.com/repos/plotly/plotly.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.js/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.js/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.js/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.js/events","assignees_url":"https://api.github.com/repos/plotly/plotly.js/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.js/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.js/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.js/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.js/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.js/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.js/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.js/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.js/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.js/merges","archive_url":"https://api.github.com/repos/plotly/plotly.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.js/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.js/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.js/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.js/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.js/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.js/releases{/id}","deployments_url":"https://api.github.com/repos/plotly/plotly.js/deployments","created_at":"2015-11-05T23:27:17Z","updated_at":"2016-06-28T12:33:13Z","pushed_at":"2016-06-28T14:08:30Z","git_url":"git://github.com/plotly/plotly.js.git","ssh_url":"git@github.com:plotly/plotly.js.git","clone_url":"https://github.com/plotly/plotly.js.git","svn_url":"https://github.com/plotly/plotly.js","homepage":"https://plot.ly/javascript/","size":117979,"stargazers_count":4890,"watchers_count":4890,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":401,"mirror_url":null,"open_issues_count":165,"forks":401,"open_issues":165,"watchers":4890,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/697"},"html":{"href":"https://github.com/plotly/plotly.js/pull/697"},"issue":{"href":"https://api.github.com/repos/plotly/plotly.js/issues/697"},"comments":{"href":"https://api.github.com/repos/plotly/plotly.js/issues/697/comments"},"review_comments":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/697/comments"},"review_comment":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/697/commits"},"statuses":{"href":"https://api.github.com/repos/plotly/plotly.js/statuses/1958dc6d5a2dce11b2400360e6fe1762c6c30269"}}}}
{"actor":{"display_login":"mdtusz"}}