{"action":"created","comment":{"url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/comments/82994773","pull_request_review_id":3862888,"id":82994773,"diff_hunk":"@@ -0,0 +1,59 @@\n+/**\n+ * @constructor\n+ */\n+function BaseType () {\n+\n+}\n+\n+/**\n+ * Must be overrided in order for the validation type to be useful\n+ *\n+ * @return {boolean}\n+ */\n+BaseType.prototype.validate = function () {\n+  return true;\n+};\n+\n+/**\n+ * Must be overrided if the type implements specific type_options\n+ *\n+ * @return {boolean}\n+ * @this IpAddressType\n+ */\n+BaseType.prototype.validateFieldSpecification = function () {\n+  return true;\n+};\n+\n+\n+/**\n+ * @param {*} object\n+ * @param {string[]} allowedProperties\n+ * @returns {boolean}\n+ */\n+BaseType.prototype.checkAllowedProperties = function (object, allowedProperties) {\n+  var result = true;\n+\n+  if (typeof object !== 'object') {","path":"lib/api/core/validation/baseType.js","position":36,"original_position":36,"commit_id":"c17990fac87d25b169b58bd11c920949195fa454","original_commit_id":"c17990fac87d25b169b58bd11c920949195fa454","user":{"login":"scottinet","id":12997967,"avatar_url":"https://avatars.githubusercontent.com/u/12997967?v=3","gravatar_id":"","url":"https://api.github.com/users/scottinet","html_url":"https://github.com/scottinet","followers_url":"https://api.github.com/users/scottinet/followers","following_url":"https://api.github.com/users/scottinet/following{/other_user}","gists_url":"https://api.github.com/users/scottinet/gists{/gist_id}","starred_url":"https://api.github.com/users/scottinet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottinet/subscriptions","organizations_url":"https://api.github.com/users/scottinet/orgs","repos_url":"https://api.github.com/users/scottinet/repos","events_url":"https://api.github.com/users/scottinet/events{/privacy}","received_events_url":"https://api.github.com/users/scottinet/received_events","type":"User","site_admin":false},"body":"Beware: `typeof null` and `typeof <array>` also return `object`","created_at":"2016-10-12T12:34:51Z","updated_at":"2016-10-12T12:42:18Z","html_url":"https://github.com/kuzzleio/kuzzle/pull/418#discussion_r82994773","pull_request_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/418","_links":{"self":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/comments/82994773"},"html":{"href":"https://github.com/kuzzleio/kuzzle/pull/418#discussion_r82994773"},"pull_request":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/418"}}},"pull_request":{"url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/418","id":87894306,"html_url":"https://github.com/kuzzleio/kuzzle/pull/418","diff_url":"https://github.com/kuzzleio/kuzzle/pull/418.diff","patch_url":"https://github.com/kuzzleio/kuzzle/pull/418.patch","issue_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/418","number":418,"state":"open","locked":false,"title":"Kuz 696 Implementation of the validation mechanism","user":{"login":"dbengsch","id":16542512,"avatar_url":"https://avatars.githubusercontent.com/u/16542512?v=3","gravatar_id":"","url":"https://api.github.com/users/dbengsch","html_url":"https://github.com/dbengsch","followers_url":"https://api.github.com/users/dbengsch/followers","following_url":"https://api.github.com/users/dbengsch/following{/other_user}","gists_url":"https://api.github.com/users/dbengsch/gists{/gist_id}","starred_url":"https://api.github.com/users/dbengsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbengsch/subscriptions","organizations_url":"https://api.github.com/users/dbengsch/orgs","repos_url":"https://api.github.com/users/dbengsch/repos","events_url":"https://api.github.com/users/dbengsch/events{/privacy}","received_events_url":"https://api.github.com/users/dbengsch/received_events","type":"User","site_admin":false},"body":"- Adds a new property in the `kuzzle` object : `validation`.\r\n- Validation exposes methods to treat the validation specification (aka: the schema), check its conformity and validates the documents against it.\r\n- a call to validation is done after data:beforePublish, data:beforeCreate, data:beforeCreateOrReplace, data:beforeUpdate a,d data:beforeReplace\r\n- **Plugin context** : a new constructor and new accessors have been introduced to interaction with the validation: \r\n - context.constructors.BaseValidationType : This constructor must be extended by the validation types in order to be used in the validation mechanism.\r\n - context.accessors.validation.addType : Adds a new type to the validation (must be a constructor that extends `BaseValidationType`).\r\n - context.accessors.validation.validate : Takes a `requestObject` in argument and validate it against the specification; returns true when it succeeds, false otherwise.","created_at":"2016-10-04T13:31:16Z","updated_at":"2016-10-12T12:42:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83edfc76e6f9857092362961ed3b996d15085a4c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/418/commits","review_comments_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/418/comments","review_comment_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/418/comments","statuses_url":"https://api.github.com/repos/kuzzleio/kuzzle/statuses/c17990fac87d25b169b58bd11c920949195fa454","head":{"label":"kuzzleio:KUZ-696-validation","ref":"KUZ-696-validation","sha":"c17990fac87d25b169b58bd11c920949195fa454","user":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"repo":{"id":41084349,"name":"kuzzle","full_name":"kuzzleio/kuzzle","owner":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kuzzleio/kuzzle","description":"Open-source Back-end, self-hostable & ready to use - Real-time, storage, advanced search - Web, Apps, Mobile, IoT -","fork":false,"url":"https://api.github.com/repos/kuzzleio/kuzzle","forks_url":"https://api.github.com/repos/kuzzleio/kuzzle/forks","keys_url":"https://api.github.com/repos/kuzzleio/kuzzle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kuzzleio/kuzzle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kuzzleio/kuzzle/teams","hooks_url":"https://api.github.com/repos/kuzzleio/kuzzle/hooks","issue_events_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/events{/number}","events_url":"https://api.github.com/repos/kuzzleio/kuzzle/events","assignees_url":"https://api.github.com/repos/kuzzleio/kuzzle/assignees{/user}","branches_url":"https://api.github.com/repos/kuzzleio/kuzzle/branches{/branch}","tags_url":"https://api.github.com/repos/kuzzleio/kuzzle/tags","blobs_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/refs{/sha}","trees_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kuzzleio/kuzzle/statuses/{sha}","languages_url":"https://api.github.com/repos/kuzzleio/kuzzle/languages","stargazers_url":"https://api.github.com/repos/kuzzleio/kuzzle/stargazers","contributors_url":"https://api.github.com/repos/kuzzleio/kuzzle/contributors","subscribers_url":"https://api.github.com/repos/kuzzleio/kuzzle/subscribers","subscription_url":"https://api.github.com/repos/kuzzleio/kuzzle/subscription","commits_url":"https://api.github.com/repos/kuzzleio/kuzzle/commits{/sha}","git_commits_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/commits{/sha}","comments_url":"https://api.github.com/repos/kuzzleio/kuzzle/comments{/number}","issue_comment_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/comments{/number}","contents_url":"https://api.github.com/repos/kuzzleio/kuzzle/contents/{+path}","compare_url":"https://api.github.com/repos/kuzzleio/kuzzle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kuzzleio/kuzzle/merges","archive_url":"https://api.github.com/repos/kuzzleio/kuzzle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kuzzleio/kuzzle/downloads","issues_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues{/number}","pulls_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls{/number}","milestones_url":"https://api.github.com/repos/kuzzleio/kuzzle/milestones{/number}","notifications_url":"https://api.github.com/repos/kuzzleio/kuzzle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kuzzleio/kuzzle/labels{/name}","releases_url":"https://api.github.com/repos/kuzzleio/kuzzle/releases{/id}","deployments_url":"https://api.github.com/repos/kuzzleio/kuzzle/deployments","created_at":"2015-08-20T08:26:57Z","updated_at":"2016-10-06T02:13:31Z","pushed_at":"2016-10-12T11:50:21Z","git_url":"git://github.com/kuzzleio/kuzzle.git","ssh_url":"git@github.com:kuzzleio/kuzzle.git","clone_url":"https://github.com/kuzzleio/kuzzle.git","svn_url":"https://github.com/kuzzleio/kuzzle","homepage":"http://kuzzle.io","size":8600,"stargazers_count":332,"watchers_count":332,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":13,"forks":19,"open_issues":13,"watchers":332,"default_branch":"master"}},"base":{"label":"kuzzleio:develop","ref":"develop","sha":"ea2b3db1154d9fc9d1f97a9e488e0ae122777519","user":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"repo":{"id":41084349,"name":"kuzzle","full_name":"kuzzleio/kuzzle","owner":{"login":"kuzzleio","id":12933347,"avatar_url":"https://avatars.githubusercontent.com/u/12933347?v=3","gravatar_id":"","url":"https://api.github.com/users/kuzzleio","html_url":"https://github.com/kuzzleio","followers_url":"https://api.github.com/users/kuzzleio/followers","following_url":"https://api.github.com/users/kuzzleio/following{/other_user}","gists_url":"https://api.github.com/users/kuzzleio/gists{/gist_id}","starred_url":"https://api.github.com/users/kuzzleio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuzzleio/subscriptions","organizations_url":"https://api.github.com/users/kuzzleio/orgs","repos_url":"https://api.github.com/users/kuzzleio/repos","events_url":"https://api.github.com/users/kuzzleio/events{/privacy}","received_events_url":"https://api.github.com/users/kuzzleio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kuzzleio/kuzzle","description":"Open-source Back-end, self-hostable & ready to use - Real-time, storage, advanced search - Web, Apps, Mobile, IoT -","fork":false,"url":"https://api.github.com/repos/kuzzleio/kuzzle","forks_url":"https://api.github.com/repos/kuzzleio/kuzzle/forks","keys_url":"https://api.github.com/repos/kuzzleio/kuzzle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kuzzleio/kuzzle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kuzzleio/kuzzle/teams","hooks_url":"https://api.github.com/repos/kuzzleio/kuzzle/hooks","issue_events_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/events{/number}","events_url":"https://api.github.com/repos/kuzzleio/kuzzle/events","assignees_url":"https://api.github.com/repos/kuzzleio/kuzzle/assignees{/user}","branches_url":"https://api.github.com/repos/kuzzleio/kuzzle/branches{/branch}","tags_url":"https://api.github.com/repos/kuzzleio/kuzzle/tags","blobs_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/refs{/sha}","trees_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kuzzleio/kuzzle/statuses/{sha}","languages_url":"https://api.github.com/repos/kuzzleio/kuzzle/languages","stargazers_url":"https://api.github.com/repos/kuzzleio/kuzzle/stargazers","contributors_url":"https://api.github.com/repos/kuzzleio/kuzzle/contributors","subscribers_url":"https://api.github.com/repos/kuzzleio/kuzzle/subscribers","subscription_url":"https://api.github.com/repos/kuzzleio/kuzzle/subscription","commits_url":"https://api.github.com/repos/kuzzleio/kuzzle/commits{/sha}","git_commits_url":"https://api.github.com/repos/kuzzleio/kuzzle/git/commits{/sha}","comments_url":"https://api.github.com/repos/kuzzleio/kuzzle/comments{/number}","issue_comment_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues/comments{/number}","contents_url":"https://api.github.com/repos/kuzzleio/kuzzle/contents/{+path}","compare_url":"https://api.github.com/repos/kuzzleio/kuzzle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kuzzleio/kuzzle/merges","archive_url":"https://api.github.com/repos/kuzzleio/kuzzle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kuzzleio/kuzzle/downloads","issues_url":"https://api.github.com/repos/kuzzleio/kuzzle/issues{/number}","pulls_url":"https://api.github.com/repos/kuzzleio/kuzzle/pulls{/number}","milestones_url":"https://api.github.com/repos/kuzzleio/kuzzle/milestones{/number}","notifications_url":"https://api.github.com/repos/kuzzleio/kuzzle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kuzzleio/kuzzle/labels{/name}","releases_url":"https://api.github.com/repos/kuzzleio/kuzzle/releases{/id}","deployments_url":"https://api.github.com/repos/kuzzleio/kuzzle/deployments","created_at":"2015-08-20T08:26:57Z","updated_at":"2016-10-06T02:13:31Z","pushed_at":"2016-10-12T11:50:21Z","git_url":"git://github.com/kuzzleio/kuzzle.git","ssh_url":"git@github.com:kuzzleio/kuzzle.git","clone_url":"https://github.com/kuzzleio/kuzzle.git","svn_url":"https://github.com/kuzzleio/kuzzle","homepage":"http://kuzzle.io","size":8600,"stargazers_count":332,"watchers_count":332,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":13,"forks":19,"open_issues":13,"watchers":332,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/418"},"html":{"href":"https://github.com/kuzzleio/kuzzle/pull/418"},"issue":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/issues/418"},"comments":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/issues/418/comments"},"review_comments":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/418/comments"},"review_comment":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/pulls/418/commits"},"statuses":{"href":"https://api.github.com/repos/kuzzleio/kuzzle/statuses/c17990fac87d25b169b58bd11c920949195fa454"}}}}
{"actor":{"display_login":"scottinet"}}