{"action":"created","comment":{"url":"https://api.github.com/repos/allegro/hermes/pulls/comments/56018485","id":56018485,"diff_hunk":"@@ -7,29 +7,19 @@\n import org.apache.avro.io.DecoderFactory;\n import pl.allegro.tech.hermes.api.ContentType;\n import pl.allegro.tech.hermes.api.Topic;\n-import pl.allegro.tech.hermes.domain.topic.schema.SchemaRepository;\n-\n-import javax.inject.Inject;\n+import pl.allegro.tech.hermes.frontend.publishing.message.Message;\n \n public class AvroTopicMessageValidator implements TopicMessageValidator {\n \n-    private final SchemaRepository<Schema> schemaRepository;\n-\n-    @Inject\n-    public AvroTopicMessageValidator(SchemaRepository<Schema> schemaRepository) {\n-        this.schemaRepository = schemaRepository;\n-    }\n-\n     @Override\n-    public void check(byte[] message, Topic topic) {\n-        if (ContentType.AVRO != topic.getContentType()) {\n+    public void check(Message message, Topic topic) {\n+        if (ContentType.AVRO != topic.getContentType() || (ContentType.JSON == topic.getContentType() && !topic.isJsonToAvroDryRunEnabled())) {\n             return;\n         }\n \n-        Schema schema = schemaRepository.getSchema(topic);\n-        BinaryDecoder binaryDecoder = DecoderFactory.get().binaryDecoder(message, null);\n+        BinaryDecoder binaryDecoder = DecoderFactory.get().binaryDecoder(message.getData(), null);\n         try {\n-            new GenericDatumReader<>(schema).read(null, binaryDecoder);\n+            new GenericDatumReader<>(message.<Schema>getSchema().get().getSchema()).read(null, binaryDecoder);","path":"hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/validator/AvroTopicMessageValidator.java","position":31,"original_position":31,"commit_id":"a0a757d79d8eff7ac37405616c156206218ebafa","original_commit_id":"a0a757d79d8eff7ac37405616c156206218ebafa","user":{"login":"chemicL","id":2554306,"avatar_url":"https://avatars.githubusercontent.com/u/2554306?v=3","gravatar_id":"","url":"https://api.github.com/users/chemicL","html_url":"https://github.com/chemicL","followers_url":"https://api.github.com/users/chemicL/followers","following_url":"https://api.github.com/users/chemicL/following{/other_user}","gists_url":"https://api.github.com/users/chemicL/gists{/gist_id}","starred_url":"https://api.github.com/users/chemicL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chemicL/subscriptions","organizations_url":"https://api.github.com/users/chemicL/orgs","repos_url":"https://api.github.com/users/chemicL/repos","events_url":"https://api.github.com/users/chemicL/events{/privacy}","received_events_url":"https://api.github.com/users/chemicL/received_events","type":"User","site_admin":false},"body":"`message.<Schema>getSchema().get().getSchema()` looks awkward, perhaps more explicit naming?","created_at":"2016-03-14T15:27:26Z","updated_at":"2016-03-14T15:27:26Z","html_url":"https://github.com/allegro/hermes/pull/390#discussion_r56018485","pull_request_url":"https://api.github.com/repos/allegro/hermes/pulls/390","_links":{"self":{"href":"https://api.github.com/repos/allegro/hermes/pulls/comments/56018485"},"html":{"href":"https://github.com/allegro/hermes/pull/390#discussion_r56018485"},"pull_request":{"href":"https://api.github.com/repos/allegro/hermes/pulls/390"}}},"pull_request":{"url":"https://api.github.com/repos/allegro/hermes/pulls/390","id":62370163,"html_url":"https://github.com/allegro/hermes/pull/390","diff_url":"https://github.com/allegro/hermes/pull/390.diff","patch_url":"https://github.com/allegro/hermes/pull/390.patch","issue_url":"https://api.github.com/repos/allegro/hermes/issues/390","number":390,"state":"open","locked":false,"title":"380 schema version aware serialization","user":{"login":"wojtkiewicz","id":11539876,"avatar_url":"https://avatars.githubusercontent.com/u/11539876?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtkiewicz","html_url":"https://github.com/wojtkiewicz","followers_url":"https://api.github.com/users/wojtkiewicz/followers","following_url":"https://api.github.com/users/wojtkiewicz/following{/other_user}","gists_url":"https://api.github.com/users/wojtkiewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtkiewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtkiewicz/subscriptions","organizations_url":"https://api.github.com/users/wojtkiewicz/orgs","repos_url":"https://api.github.com/users/wojtkiewicz/repos","events_url":"https://api.github.com/users/wojtkiewicz/events{/privacy}","received_events_url":"https://api.github.com/users/wojtkiewicz/received_events","type":"User","site_admin":false},"body":"Scope:\r\n* support for multiple schema versions\r\n* support for avro magic_byte format (enabled via topic.schemaVersionAwareSerializationEnabled)\r\n\r\nDon't worry we will squash these commits.","created_at":"2016-03-10T10:43:06Z","updated_at":"2016-03-14T15:27:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0cd75765be0652a6b0fcb9e35eed367860f73754","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/allegro/hermes/pulls/390/commits","review_comments_url":"https://api.github.com/repos/allegro/hermes/pulls/390/comments","review_comment_url":"https://api.github.com/repos/allegro/hermes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/allegro/hermes/issues/390/comments","statuses_url":"https://api.github.com/repos/allegro/hermes/statuses/a0a757d79d8eff7ac37405616c156206218ebafa","head":{"label":"allegro:380_schema-version-aware-serialization","ref":"380_schema-version-aware-serialization","sha":"a0a757d79d8eff7ac37405616c156206218ebafa","user":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"repo":{"id":35662043,"name":"hermes","full_name":"allegro/hermes","owner":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allegro/hermes","description":"Fast and reliable message broker built on top of Kafka.","fork":false,"url":"https://api.github.com/repos/allegro/hermes","forks_url":"https://api.github.com/repos/allegro/hermes/forks","keys_url":"https://api.github.com/repos/allegro/hermes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allegro/hermes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allegro/hermes/teams","hooks_url":"https://api.github.com/repos/allegro/hermes/hooks","issue_events_url":"https://api.github.com/repos/allegro/hermes/issues/events{/number}","events_url":"https://api.github.com/repos/allegro/hermes/events","assignees_url":"https://api.github.com/repos/allegro/hermes/assignees{/user}","branches_url":"https://api.github.com/repos/allegro/hermes/branches{/branch}","tags_url":"https://api.github.com/repos/allegro/hermes/tags","blobs_url":"https://api.github.com/repos/allegro/hermes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allegro/hermes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allegro/hermes/git/refs{/sha}","trees_url":"https://api.github.com/repos/allegro/hermes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allegro/hermes/statuses/{sha}","languages_url":"https://api.github.com/repos/allegro/hermes/languages","stargazers_url":"https://api.github.com/repos/allegro/hermes/stargazers","contributors_url":"https://api.github.com/repos/allegro/hermes/contributors","subscribers_url":"https://api.github.com/repos/allegro/hermes/subscribers","subscription_url":"https://api.github.com/repos/allegro/hermes/subscription","commits_url":"https://api.github.com/repos/allegro/hermes/commits{/sha}","git_commits_url":"https://api.github.com/repos/allegro/hermes/git/commits{/sha}","comments_url":"https://api.github.com/repos/allegro/hermes/comments{/number}","issue_comment_url":"https://api.github.com/repos/allegro/hermes/issues/comments{/number}","contents_url":"https://api.github.com/repos/allegro/hermes/contents/{+path}","compare_url":"https://api.github.com/repos/allegro/hermes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allegro/hermes/merges","archive_url":"https://api.github.com/repos/allegro/hermes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allegro/hermes/downloads","issues_url":"https://api.github.com/repos/allegro/hermes/issues{/number}","pulls_url":"https://api.github.com/repos/allegro/hermes/pulls{/number}","milestones_url":"https://api.github.com/repos/allegro/hermes/milestones{/number}","notifications_url":"https://api.github.com/repos/allegro/hermes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allegro/hermes/labels{/name}","releases_url":"https://api.github.com/repos/allegro/hermes/releases{/id}","deployments_url":"https://api.github.com/repos/allegro/hermes/deployments","created_at":"2015-05-15T08:11:16Z","updated_at":"2016-03-09T14:52:57Z","pushed_at":"2016-03-14T13:36:20Z","git_url":"git://github.com/allegro/hermes.git","ssh_url":"git@github.com:allegro/hermes.git","clone_url":"https://github.com/allegro/hermes.git","svn_url":"https://github.com/allegro/hermes","homepage":"http://hermes.allegro.tech","size":4439,"stargazers_count":158,"watchers_count":158,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":34,"forks":28,"open_issues":34,"watchers":158,"default_branch":"master"}},"base":{"label":"allegro:develop","ref":"develop","sha":"8ff35e4cfdd463a1ba0fa01bf2688e3217f8fe53","user":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"repo":{"id":35662043,"name":"hermes","full_name":"allegro/hermes","owner":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=3","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allegro/hermes","description":"Fast and reliable message broker built on top of Kafka.","fork":false,"url":"https://api.github.com/repos/allegro/hermes","forks_url":"https://api.github.com/repos/allegro/hermes/forks","keys_url":"https://api.github.com/repos/allegro/hermes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allegro/hermes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allegro/hermes/teams","hooks_url":"https://api.github.com/repos/allegro/hermes/hooks","issue_events_url":"https://api.github.com/repos/allegro/hermes/issues/events{/number}","events_url":"https://api.github.com/repos/allegro/hermes/events","assignees_url":"https://api.github.com/repos/allegro/hermes/assignees{/user}","branches_url":"https://api.github.com/repos/allegro/hermes/branches{/branch}","tags_url":"https://api.github.com/repos/allegro/hermes/tags","blobs_url":"https://api.github.com/repos/allegro/hermes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allegro/hermes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allegro/hermes/git/refs{/sha}","trees_url":"https://api.github.com/repos/allegro/hermes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allegro/hermes/statuses/{sha}","languages_url":"https://api.github.com/repos/allegro/hermes/languages","stargazers_url":"https://api.github.com/repos/allegro/hermes/stargazers","contributors_url":"https://api.github.com/repos/allegro/hermes/contributors","subscribers_url":"https://api.github.com/repos/allegro/hermes/subscribers","subscription_url":"https://api.github.com/repos/allegro/hermes/subscription","commits_url":"https://api.github.com/repos/allegro/hermes/commits{/sha}","git_commits_url":"https://api.github.com/repos/allegro/hermes/git/commits{/sha}","comments_url":"https://api.github.com/repos/allegro/hermes/comments{/number}","issue_comment_url":"https://api.github.com/repos/allegro/hermes/issues/comments{/number}","contents_url":"https://api.github.com/repos/allegro/hermes/contents/{+path}","compare_url":"https://api.github.com/repos/allegro/hermes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allegro/hermes/merges","archive_url":"https://api.github.com/repos/allegro/hermes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allegro/hermes/downloads","issues_url":"https://api.github.com/repos/allegro/hermes/issues{/number}","pulls_url":"https://api.github.com/repos/allegro/hermes/pulls{/number}","milestones_url":"https://api.github.com/repos/allegro/hermes/milestones{/number}","notifications_url":"https://api.github.com/repos/allegro/hermes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allegro/hermes/labels{/name}","releases_url":"https://api.github.com/repos/allegro/hermes/releases{/id}","deployments_url":"https://api.github.com/repos/allegro/hermes/deployments","created_at":"2015-05-15T08:11:16Z","updated_at":"2016-03-09T14:52:57Z","pushed_at":"2016-03-14T13:36:20Z","git_url":"git://github.com/allegro/hermes.git","ssh_url":"git@github.com:allegro/hermes.git","clone_url":"https://github.com/allegro/hermes.git","svn_url":"https://github.com/allegro/hermes","homepage":"http://hermes.allegro.tech","size":4439,"stargazers_count":158,"watchers_count":158,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":34,"forks":28,"open_issues":34,"watchers":158,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/allegro/hermes/pulls/390"},"html":{"href":"https://github.com/allegro/hermes/pull/390"},"issue":{"href":"https://api.github.com/repos/allegro/hermes/issues/390"},"comments":{"href":"https://api.github.com/repos/allegro/hermes/issues/390/comments"},"review_comments":{"href":"https://api.github.com/repos/allegro/hermes/pulls/390/comments"},"review_comment":{"href":"https://api.github.com/repos/allegro/hermes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/allegro/hermes/pulls/390/commits"},"statuses":{"href":"https://api.github.com/repos/allegro/hermes/statuses/a0a757d79d8eff7ac37405616c156206218ebafa"}}}}