{"action":"created","comment":{"url":"https://api.github.com/repos/zalando/nakadi/pulls/comments/86782806","pull_request_review_id":7421904,"id":86782806,"diff_hunk":"@@ -0,0 +1,114 @@\n+package org.zalando.nakadi.validation;\n+\n+import org.everit.json.schema.ArraySchema;\n+import org.everit.json.schema.CombinedSchema;\n+import org.everit.json.schema.ObjectSchema;\n+import org.everit.json.schema.ReferenceSchema;\n+import org.everit.json.schema.Schema;\n+import org.zalando.nakadi.validation.schema.SchemaConstraint;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.Optional;\n+import java.util.Stack;\n+\n+public class SchemaCompatibilityChecker {\n+\n+    private final List<SchemaConstraint> constraints;\n+\n+    public SchemaCompatibilityChecker(final List<SchemaConstraint> constraints) {\n+        this.constraints = constraints;\n+    }\n+\n+    public List<SchemaIncompatibility> checkConstraints(final Schema schema) {\n+        final List<SchemaIncompatibility> incompatibilities = new ArrayList<>();\n+\n+        recursiveCheckConstraints(schema, new Stack<>(), incompatibilities);\n+\n+        return incompatibilities;\n+    }\n+\n+    private void recursiveCheckConstraints(\n+            final Schema schema,\n+            final Stack<String> jsonPath,\n+            final List<SchemaIncompatibility> schemaIncompatibilities) {\n+\n+        for (final SchemaConstraint constraint : constraints) {\n+            final Optional<SchemaIncompatibility> incompatibility = constraint.validate(jsonPath, schema);\n+            if (incompatibility.isPresent()) {\n+                schemaIncompatibilities.add(incompatibility.get());\n+            }\n+        }\n+\n+        if (schema instanceof ObjectSchema) {","path":"src/main/java/org/zalando/nakadi/validation/SchemaCompatibilityChecker.java","position":44,"original_position":44,"commit_id":"afabd8d04798f11e26656e33b5ab7ded83dac5e2","original_commit_id":"53b5d63cab2b237cd90d0d98acecfa30eeffcef6","user":{"login":"adyach","id":4863810,"avatar_url":"https://avatars.githubusercontent.com/u/4863810?v=3","gravatar_id":"","url":"https://api.github.com/users/adyach","html_url":"https://github.com/adyach","followers_url":"https://api.github.com/users/adyach/followers","following_url":"https://api.github.com/users/adyach/following{/other_user}","gists_url":"https://api.github.com/users/adyach/gists{/gist_id}","starred_url":"https://api.github.com/users/adyach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adyach/subscriptions","organizations_url":"https://api.github.com/users/adyach/orgs","repos_url":"https://api.github.com/users/adyach/repos","events_url":"https://api.github.com/users/adyach/events{/privacy}","received_events_url":"https://api.github.com/users/adyach/received_events","type":"User","site_admin":false},"body":"I think there are two ways:\r\n1. extend/wrap schema library objects, but it won't solve the issue of casting I will have to cast anyway.\r\n2. the second approach is to add a little bit of code to the library and build it.\r\nAll approaches have their own downsides. Maybe we can solve it later if we need support for more constraints/schema types.","created_at":"2016-11-07T14:16:25Z","updated_at":"2016-11-07T14:16:25Z","html_url":"https://github.com/zalando/nakadi/pull/475#discussion_r86782806","pull_request_url":"https://api.github.com/repos/zalando/nakadi/pulls/475","_links":{"self":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/comments/86782806"},"html":{"href":"https://github.com/zalando/nakadi/pull/475#discussion_r86782806"},"pull_request":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/475"}}},"pull_request":{"url":"https://api.github.com/repos/zalando/nakadi/pulls/475","id":91825744,"html_url":"https://github.com/zalando/nakadi/pull/475","diff_url":"https://github.com/zalando/nakadi/pull/475.diff","patch_url":"https://github.com/zalando/nakadi/pull/475.patch","issue_url":"https://api.github.com/repos/zalando/nakadi/issues/475","number":475,"state":"open","locked":false,"title":"Aruha 400 update schema - part 1","user":{"login":"rcillo","id":344648,"avatar_url":"https://avatars.githubusercontent.com/u/344648?v=3","gravatar_id":"","url":"https://api.github.com/users/rcillo","html_url":"https://github.com/rcillo","followers_url":"https://api.github.com/users/rcillo/followers","following_url":"https://api.github.com/users/rcillo/following{/other_user}","gists_url":"https://api.github.com/users/rcillo/gists{/gist_id}","starred_url":"https://api.github.com/users/rcillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcillo/subscriptions","organizations_url":"https://api.github.com/users/rcillo/orgs","repos_url":"https://api.github.com/users/rcillo/repos","events_url":"https://api.github.com/users/rcillo/events{/privacy}","received_events_url":"https://api.github.com/users/rcillo/received_events","type":"User","site_admin":false},"body":"This PR introduces the validation of forbidden features, such as \"not\" and \"patternProperties\".\r\n\r\nFrom now on it won't be possible to create event types whose schemas contains these attributes.\r\n\r\nThe reasoning behind these decisions is part of the concept https://docs.google.com/document/d/1FmGHxI9oklxN16LKZe1UG_U21jtQFVCtLtRiC2W1pAk/edit\r\n\r\nNext steps:\r\n\r\n- introduce compatibility mode attribute to event types\r\n- introduce version\r\n- introduce schema update with compatibility checks","created_at":"2016-11-01T17:23:23Z","updated_at":"2016-11-07T14:16:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dfbe48266202ec150fe35f6accb299a83c71c065","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zalando/nakadi/pulls/475/commits","review_comments_url":"https://api.github.com/repos/zalando/nakadi/pulls/475/comments","review_comment_url":"https://api.github.com/repos/zalando/nakadi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zalando/nakadi/issues/475/comments","statuses_url":"https://api.github.com/repos/zalando/nakadi/statuses/afabd8d04798f11e26656e33b5ab7ded83dac5e2","head":{"label":"zalando:aruha-400-update-schema","ref":"aruha-400-update-schema","sha":"afabd8d04798f11e26656e33b5ab7ded83dac5e2","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":44234368,"name":"nakadi","full_name":"zalando/nakadi","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/nakadi","description":"A distributed event bus that implements a RESTful API abstraction instead of Kafka-like queues","fork":false,"url":"https://api.github.com/repos/zalando/nakadi","forks_url":"https://api.github.com/repos/zalando/nakadi/forks","keys_url":"https://api.github.com/repos/zalando/nakadi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/nakadi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/nakadi/teams","hooks_url":"https://api.github.com/repos/zalando/nakadi/hooks","issue_events_url":"https://api.github.com/repos/zalando/nakadi/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/nakadi/events","assignees_url":"https://api.github.com/repos/zalando/nakadi/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/nakadi/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/nakadi/tags","blobs_url":"https://api.github.com/repos/zalando/nakadi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/nakadi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/nakadi/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/nakadi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/nakadi/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/nakadi/languages","stargazers_url":"https://api.github.com/repos/zalando/nakadi/stargazers","contributors_url":"https://api.github.com/repos/zalando/nakadi/contributors","subscribers_url":"https://api.github.com/repos/zalando/nakadi/subscribers","subscription_url":"https://api.github.com/repos/zalando/nakadi/subscription","commits_url":"https://api.github.com/repos/zalando/nakadi/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/nakadi/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/nakadi/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/nakadi/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/nakadi/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/nakadi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/nakadi/merges","archive_url":"https://api.github.com/repos/zalando/nakadi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/nakadi/downloads","issues_url":"https://api.github.com/repos/zalando/nakadi/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/nakadi/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/nakadi/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/nakadi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/nakadi/labels{/name}","releases_url":"https://api.github.com/repos/zalando/nakadi/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/nakadi/deployments","created_at":"2015-10-14T08:30:17Z","updated_at":"2016-11-04T20:37:37Z","pushed_at":"2016-11-07T13:59:26Z","git_url":"git://github.com/zalando/nakadi.git","ssh_url":"git@github.com:zalando/nakadi.git","clone_url":"https://github.com/zalando/nakadi.git","svn_url":"https://github.com/zalando/nakadi","homepage":"","size":4223,"stargazers_count":57,"watchers_count":57,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":25,"forks":30,"open_issues":25,"watchers":57,"default_branch":"master"}},"base":{"label":"zalando:aruha-399-schema-evolution","ref":"aruha-399-schema-evolution","sha":"ad881cb9c3a30983448e7e461aee0800945c038e","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":44234368,"name":"nakadi","full_name":"zalando/nakadi","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/nakadi","description":"A distributed event bus that implements a RESTful API abstraction instead of Kafka-like queues","fork":false,"url":"https://api.github.com/repos/zalando/nakadi","forks_url":"https://api.github.com/repos/zalando/nakadi/forks","keys_url":"https://api.github.com/repos/zalando/nakadi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/nakadi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/nakadi/teams","hooks_url":"https://api.github.com/repos/zalando/nakadi/hooks","issue_events_url":"https://api.github.com/repos/zalando/nakadi/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/nakadi/events","assignees_url":"https://api.github.com/repos/zalando/nakadi/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/nakadi/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/nakadi/tags","blobs_url":"https://api.github.com/repos/zalando/nakadi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/nakadi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/nakadi/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/nakadi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/nakadi/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/nakadi/languages","stargazers_url":"https://api.github.com/repos/zalando/nakadi/stargazers","contributors_url":"https://api.github.com/repos/zalando/nakadi/contributors","subscribers_url":"https://api.github.com/repos/zalando/nakadi/subscribers","subscription_url":"https://api.github.com/repos/zalando/nakadi/subscription","commits_url":"https://api.github.com/repos/zalando/nakadi/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/nakadi/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/nakadi/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/nakadi/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/nakadi/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/nakadi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/nakadi/merges","archive_url":"https://api.github.com/repos/zalando/nakadi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/nakadi/downloads","issues_url":"https://api.github.com/repos/zalando/nakadi/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/nakadi/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/nakadi/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/nakadi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/nakadi/labels{/name}","releases_url":"https://api.github.com/repos/zalando/nakadi/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/nakadi/deployments","created_at":"2015-10-14T08:30:17Z","updated_at":"2016-11-04T20:37:37Z","pushed_at":"2016-11-07T13:59:26Z","git_url":"git://github.com/zalando/nakadi.git","ssh_url":"git@github.com:zalando/nakadi.git","clone_url":"https://github.com/zalando/nakadi.git","svn_url":"https://github.com/zalando/nakadi","homepage":"","size":4223,"stargazers_count":57,"watchers_count":57,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":30,"mirror_url":null,"open_issues_count":25,"forks":30,"open_issues":25,"watchers":57,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/475"},"html":{"href":"https://github.com/zalando/nakadi/pull/475"},"issue":{"href":"https://api.github.com/repos/zalando/nakadi/issues/475"},"comments":{"href":"https://api.github.com/repos/zalando/nakadi/issues/475/comments"},"review_comments":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/475/comments"},"review_comment":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/475/commits"},"statuses":{"href":"https://api.github.com/repos/zalando/nakadi/statuses/afabd8d04798f11e26656e33b5ab7ded83dac5e2"}}}}
{"actor":{"display_login":"adyach"}}