{"action":"created","comment":{"url":"https://api.github.com/repos/zalando/nakadi/pulls/comments/48721838","id":48721838,"diff_hunk":"@@ -0,0 +1,133 @@\n+package de.zalando.aruha.nakadi.validation;\n+\n+import static org.junit.Assert.*;\n+\n+import org.json.JSONObject;\n+\n+import org.junit.After;\n+import org.junit.Test;\n+\n+import de.zalando.aruha.nakadi.domain.EventType;\n+import de.zalando.aruha.nakadi.domain.EventTypeSchema;\n+import de.zalando.aruha.nakadi.domain.EventTypeSchema.Type;\n+import de.zalando.aruha.nakadi.domain.ValidationStrategyConfiguration;\n+\n+public class JSONSchemaValidationTest {\n+\n+    @Test\n+    public void eventValidationRegistryShouldResolveTypes() {\n+        final EventType et = new EventType();\n+        et.setName(\"some-event-type\");\n+\n+        final EventType other = new EventType();\n+        other.setName(\"some-other-event-type\");\n+\n+        final EventTypeValidator validator = EventValidation.forType(et);\n+        assertNotNull(validator);\n+        assertEquals(validator, EventValidation.lookup(et));\n+        assertNull(EventValidation.lookup(other));\n+\n+    }\n+\n+    @Test(expected = IllegalStateException.class)\n+    public void eventValidationRegistryShouldDenyRespecification() {\n+        final EventType et = new EventType();\n+        et.setName(\"some-event-type\");\n+        EventValidation.forType(et);\n+        EventValidation.forType(et);\n+    }\n+\n+    @Test\n+    public void eventValidationRegistryShouldAllowRespecificationIfRequestedExplicitly() {\n+        final EventType et = new EventType();\n+        et.setName(\"some-event-type\");\n+\n+        final EventTypeValidator validator = EventValidation.forType(et);\n+        assertNotNull(validator);\n+        assertSame(validator, EventValidation.forType(et, true));\n+    }\n+\n+    @Test\n+    public void schemaValidationShouldRespectEventTypeDefinition() {\n+        final EventType et = buildAndRegisterEventType(\"some-event-type\",\n+                new JSONObject(\n+                    \"{\\\"type\\\": \\\"object\\\", \\\"properties\\\": {\\\"foo\\\": {\\\"type\\\": \\\"string\\\"}}, \\\"required\\\": [\\\"foo\\\"]}\"));\n+\n+        final ValidationStrategyConfiguration vsc1 = new ValidationStrategyConfiguration();\n+        vsc1.setStrategyName(EventBodyMustRespectSchema.NAME);\n+        et.getValidationStrategies().add(vsc1);\n+\n+        final ValidationStrategyConfiguration vsc2 = new ValidationStrategyConfiguration();\n+        vsc2.setStrategyName(FieldNameMustBeSet.NAME);\n+        et.getValidationStrategies().add(vsc2);\n+        EventValidation.forType(et).withConfiguration(vsc1).withConfiguration(vsc2).init();\n+\n+        final EventTypeValidator validator = EventValidation.lookup(et);\n+\n+        final JSONObject event = new JSONObject(\n+                \"{\\\"foo\\\": \\\"bar\\\", \\\"extra\\\": \\\"i should be no problem\\\", \\\"name\\\": \\\"12345\\\"}\");\n+\n+        validator.validate(event);\n+    }\n+\n+    private EventType buildAndRegisterEventType(final String name, final JSONObject schema) {","path":"src/test/java/de/zalando/aruha/nakadi/validation/JSONSchemaValidationTest.java","position":73,"original_position":73,"commit_id":"7aa09a5b961aad3c2c8d9b82ee9600c07ea24ff7","original_commit_id":"78a5aed6b2288be094c79373ffb5344bb0ce1342","user":{"login":"v-stepanov","id":13309177,"avatar_url":"https://avatars.githubusercontent.com/u/13309177?v=3","gravatar_id":"","url":"https://api.github.com/users/v-stepanov","html_url":"https://github.com/v-stepanov","followers_url":"https://api.github.com/users/v-stepanov/followers","following_url":"https://api.github.com/users/v-stepanov/following{/other_user}","gists_url":"https://api.github.com/users/v-stepanov/gists{/gist_id}","starred_url":"https://api.github.com/users/v-stepanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/v-stepanov/subscriptions","organizations_url":"https://api.github.com/users/v-stepanov/orgs","repos_url":"https://api.github.com/users/v-stepanov/repos","events_url":"https://api.github.com/users/v-stepanov/events{/privacy}","received_events_url":"https://api.github.com/users/v-stepanov/received_events","type":"User","site_admin":false},"body":"can be static","created_at":"2016-01-04T11:13:17Z","updated_at":"2016-01-04T11:13:17Z","html_url":"https://github.com/zalando/nakadi/pull/55#discussion_r48721838","pull_request_url":"https://api.github.com/repos/zalando/nakadi/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/comments/48721838"},"html":{"href":"https://github.com/zalando/nakadi/pull/55#discussion_r48721838"},"pull_request":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/zalando/nakadi/pulls/55","id":54960002,"html_url":"https://github.com/zalando/nakadi/pull/55","diff_url":"https://github.com/zalando/nakadi/pull/55.diff","patch_url":"https://github.com/zalando/nakadi/pull/55.patch","issue_url":"https://api.github.com/repos/zalando/nakadi/issues/55","number":55,"state":"open","locked":false,"title":"Event validation","user":{"login":"jkliff","id":1238848,"avatar_url":"https://avatars.githubusercontent.com/u/1238848?v=3","gravatar_id":"","url":"https://api.github.com/users/jkliff","html_url":"https://github.com/jkliff","followers_url":"https://api.github.com/users/jkliff/followers","following_url":"https://api.github.com/users/jkliff/following{/other_user}","gists_url":"https://api.github.com/users/jkliff/gists{/gist_id}","starred_url":"https://api.github.com/users/jkliff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkliff/subscriptions","organizations_url":"https://api.github.com/users/jkliff/orgs","repos_url":"https://api.github.com/users/jkliff/repos","events_url":"https://api.github.com/users/jkliff/events{/privacy}","received_events_url":"https://api.github.com/users/jkliff/received_events","type":"User","site_admin":false},"body":"<a href='#crh-start'></a><a href='#crh-data-%7B%22processed%22%3A%20%5B%22https%3A//github.com/zalando/nakadi/pull/55%23issuecomment-168632664%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48718018%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48718038%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48719057%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48719207%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48719465%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48719576%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48719596%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48719706%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48720017%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48720693%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48721067%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48721103%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48721479%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48721676%22%2C%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48721778%22%5D%2C%20%22comments%22%3A%20%7B%22General%20Comment%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23issuecomment-168632664%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22%40jkliff%20Tests%20failed%20because%20of%20compilation%20problem%5Cr%5Cn%5Cr%5Cn%3E%20Execution%20failed%20for%20task%20%27%3AcompileJava%27.%5Cr%5Cn%5Cr%5Cn%3E%20Compilation%20failed%3B%20see%20the%20compiler%20error%20output%20for%20details.%5Cr%5Cn%3E%20/home/travis/build/zalando/nakadi/src/main/java/de/zalando/aruha/nakadi/validation/ValidationStrategy.java%3A16%3A%20error%3A%20cannot%20find%20symbol%5Cr%5Cn%5Cr%5Cn%3E%20STRATEGIES.put%28EventBodyMustRespectSchema.NAME%2C%20new%20EventBodyMustRespectSchema%28%29%29%3B%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A17%3A51Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%5D%2C%20%22title%22%3A%20%22General%20Comment%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%2079%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48719596%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22But%20the%20function%20actually%20finds%20element%27s%20index%2C%20not%20the%20element%20itself.%20The%20more%20appropriate%20name%20can%20be%20indexOfElement%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A41%3A48Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%3AL1-234%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%2092%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48720017%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22What%20is%20the%20purpose%20of%20this%20class%3F%20It%20seems%20to%20be%20just%20a%20list%20wrapper.%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A47%3A18Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%3AL1-234%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/main/java/de/zalando/aruha/nakadi/validation/EventValidation.java%2062%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48719057%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22I%20believe%20it%20should%20be%20allMatch%20here%20instead%20of%20anyMatch%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A34%3A41Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%2C%20%7B%22body%22%3A%20%22also%2C%20a%20lamda%20instead%20of%20new%20Predicate%20will%20simplify%20the%20code%20a%20lot.%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A36%3A43Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%2C%20%7B%22body%22%3A%20%22it%27s%20indeed%20anyMatch%3A%20we%20stop%20at%20the%20first%20that%20does%20not%20pass.%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A41%3A35Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1238848%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/jkliff%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/main/java/de/zalando/aruha/nakadi/validation/EventValidation.java%3AL1-84%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%2088%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48719706%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22I%20think%20it%27s%20actually%20a%20perfect%20place%20to%20use%20Optional%3CInteger%3E%20as%20a%20return%20type%20to%20avoid%20returning%20-1%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A43%3A15Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%3AL1-234%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/main/java/de/zalando/aruha/nakadi/validation/ValidationStrategy.java%2020%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48721676%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22I%27m%20afraid%20method%20name%20%60materialize%60%20doesn%27t%20really%20tell%20me%20much.%22%2C%20%22created_at%22%3A%20%222016-01-04T11%3A11%3A14Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%2C%20%7B%22body%22%3A%20%22With%20it%20a%20ValidationStrategy%20%28something%20abstract%29%20is%20materialized%20%28made%20concrete%29%20into%20a%20Validator.%22%2C%20%22created_at%22%3A%20%222016-01-04T11%3A12%3A27Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1238848%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/jkliff%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/main/java/de/zalando/aruha/nakadi/validation/ValidationStrategy.java%3AL1-28%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%2052%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48719465%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22lambda%3F%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A40%3A11Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%3AL1-234%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/main/java/de/zalando/aruha/nakadi/domain/ValidationStrategyConfiguration.java%2017%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48718018%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22I%20think%20it%20can%20be%20at%20least%20marked%20as%20%40Nullable%20%28or%20to%20be%20Optional%20in%20a%20perfect%20case%20%3A-D%20%29%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A21%3A08Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/main/java/de/zalando/aruha/nakadi/domain/ValidationStrategyConfiguration.java%3AL1-25%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/main/java/de/zalando/aruha/nakadi/validation/EventValidation.java%2041%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48718038%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22%40Nullable%20%3F%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A21%3A27Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/main/java/de/zalando/aruha/nakadi/validation/EventValidation.java%3AL1-84%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%20229%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48720693%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22You%20sold%20your%20soul%20to%20Jalopy%20%3A-P%22%2C%20%22created_at%22%3A%20%222016-01-04T10%3A56%3A43Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%3AL1-234%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%20175%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48721103%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22this%20can%20be%20simplified%20as%20the%20method%20accepts%20varargs%22%2C%20%22created_at%22%3A%20%222016-01-04T11%3A02%3A57Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%2C%20%7B%22body%22%3A%20%22Don%27t%20worry%20now%20about%20this%20exception%20handling/logging%20at%20this%20time.%20It%20is%20fully%20bogus.%20%22%2C%20%22created_at%22%3A%20%222016-01-04T11%3A08%3A28Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/1238848%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/jkliff%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%3AL1-234%22%7D%2C%20%22Pull%2078a5aed6b2288be094c79373ffb5344bb0ce1342%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%20173%22%3A%20%7B%22html_url%22%3A%20%22https%3A//github.com/zalando/nakadi/pull/55%23discussion_r48721067%22%2C%20%22comments%22%3A%20%5B%7B%22body%22%3A%20%22I%20believe%20this%20is%20not%20needed%20as%20you%20pass%20the%20exception%20to%20logger%20any%20way.%22%2C%20%22created_at%22%3A%20%222016-01-04T11%3A02%3A18Z%22%2C%20%22user%22%3A%20%7B%22avatar_url%22%3A%20%22https%3A//avatars.githubusercontent.com/u/13309177%3Fv%3D3%22%2C%20%22html_url%22%3A%20%22https%3A//github.com/v-stepanov%22%7D%7D%5D%2C%20%22title%22%3A%20%22File%3A%20src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java%3AL1-234%22%7D%7D%7D'></a>\n<a href='https://www.codereviewhub.com/'><img src='http://www.codereviewhub.com/site/github-bar.png' height=40></a>\n- [ ] <a href='#crh-comment-General Comment'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#issuecomment-168632664'>General Comment</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> @jkliff Tests failed because of compilation problem\n> Execution failed for task ':compileJava'.\n> Compilation failed; see the compiler error output for details.\n> /home/travis/build/zalando/nakadi/src/main/java/de/zalando/aruha/nakadi/validation/ValidationStrategy.java:16: error: cannot find symbol\n> STRATEGIES.put(EventBodyMustRespectSchema.NAME, new EventBodyMustRespectSchema());\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/main/java/de/zalando/aruha/nakadi/domain/ValidationStrategyConfiguration.java 17'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48718018'>File: src/main/java/de/zalando/aruha/nakadi/domain/ValidationStrategyConfiguration.java:L1-25</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> I think it can be at least marked as @Nullable (or to be Optional in a perfect case :-D )\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/main/java/de/zalando/aruha/nakadi/validation/EventValidation.java 41'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48718038'>File: src/main/java/de/zalando/aruha/nakadi/validation/EventValidation.java:L1-84</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> @Nullable ?\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/main/java/de/zalando/aruha/nakadi/validation/EventValidation.java 62'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48719057'>File: src/main/java/de/zalando/aruha/nakadi/validation/EventValidation.java:L1-84</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> I believe it should be allMatch here instead of anyMatch\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> also, a lamda instead of new Predicate will simplify the code a lot.\n- <a href='https://github.com/jkliff'><img border=0 src='https://avatars.githubusercontent.com/u/1238848?v=3' height=16 width=16'></a> it's indeed anyMatch: we stop at the first that does not pass.\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java 52'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48719465'>File: src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java:L1-234</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> lambda?\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java 79'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48719596'>File: src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java:L1-234</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> But the function actually finds element's index, not the element itself. The more appropriate name can be indexOfElement\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java 88'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48719706'>File: src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java:L1-234</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> I think it's actually a perfect place to use Optional<Integer> as a return type to avoid returning -1\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java 92'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48720017'>File: src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java:L1-234</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> What is the purpose of this class? It seems to be just a list wrapper.\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java 229'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48720693'>File: src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java:L1-234</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> You sold your soul to Jalopy :-P\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java 173'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48721067'>File: src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java:L1-234</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> I believe this is not needed as you pass the exception to logger any way.\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java 175'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48721103'>File: src/test/java/de/zalando/aruha/nakadi/validation/EventBodyMustRespectSchema.java:L1-234</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> this can be simplified as the method accepts varargs\n- <a href='https://github.com/jkliff'><img border=0 src='https://avatars.githubusercontent.com/u/1238848?v=3' height=16 width=16'></a> Don't worry now about this exception handling/logging at this time. It is fully bogus.\n- [ ] <a href='#crh-comment-Pull 78a5aed6b2288be094c79373ffb5344bb0ce1342 src/main/java/de/zalando/aruha/nakadi/validation/ValidationStrategy.java 20'></a> <img src='http://www.codereviewhub.com/site/github-remaining.png' height=16 width=60>&nbsp;<b><a href='https://github.com/zalando/nakadi/pull/55#discussion_r48721676'>File: src/main/java/de/zalando/aruha/nakadi/validation/ValidationStrategy.java:L1-28</a></b>\n- <a href='https://github.com/v-stepanov'><img border=0 src='https://avatars.githubusercontent.com/u/13309177?v=3' height=16 width=16'></a> I'm afraid method name `materialize` doesn't really tell me much.\n- <a href='https://github.com/jkliff'><img border=0 src='https://avatars.githubusercontent.com/u/1238848?v=3' height=16 width=16'></a> With it a ValidationStrategy (something abstract) is materialized (made concrete) into a Validator.\n\n\n<a href='https://www.codereviewhub.com/zalando/nakadi/pull/55?mark_as_completed=1'><img src='http://www.codereviewhub.com/site/github-mark-as-completed.png' height=26></a>&nbsp;<a href='https://www.codereviewhub.com/zalando/nakadi/pull/55?approve=1'><img src='http://www.codereviewhub.com/site/github-approve.png' height=26></a>&nbsp;<a href='https://github.com/zalando/nakadi/pull/55'><img src='http://www.codereviewhub.com/site/github-refresh.png' height=26></a>\n<a href='#crh-end'></a>","created_at":"2016-01-04T10:14:43Z","updated_at":"2016-01-04T11:13:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f51747e7d19b179f9daa193e222d98bebd0efd4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zalando/nakadi/pulls/55/commits","review_comments_url":"https://api.github.com/repos/zalando/nakadi/pulls/55/comments","review_comment_url":"https://api.github.com/repos/zalando/nakadi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zalando/nakadi/issues/55/comments","statuses_url":"https://api.github.com/repos/zalando/nakadi/statuses/7aa09a5b961aad3c2c8d9b82ee9600c07ea24ff7","head":{"label":"zalando:event-validation","ref":"event-validation","sha":"7aa09a5b961aad3c2c8d9b82ee9600c07ea24ff7","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":"Zalando Distributed Event Bus","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}","created_at":"2015-10-14T08:30:17Z","updated_at":"2015-12-21T22:30:35Z","pushed_at":"2016-01-04T10:48:49Z","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":343,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":11,"forks":4,"open_issues":11,"watchers":1,"default_branch":"master"}},"base":{"label":"zalando:nakadi-jvm","ref":"nakadi-jvm","sha":"96a0c46d772088323a7fa51da7cc0291f7bf320e","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":"Zalando Distributed Event Bus","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}","created_at":"2015-10-14T08:30:17Z","updated_at":"2015-12-21T22:30:35Z","pushed_at":"2016-01-04T10:48:49Z","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":343,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":11,"forks":4,"open_issues":11,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/55"},"html":{"href":"https://github.com/zalando/nakadi/pull/55"},"issue":{"href":"https://api.github.com/repos/zalando/nakadi/issues/55"},"comments":{"href":"https://api.github.com/repos/zalando/nakadi/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zalando/nakadi/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/zalando/nakadi/statuses/7aa09a5b961aad3c2c8d9b82ee9600c07ea24ff7"}}}}