{"action":"created","comment":{"url":"https://api.github.com/repos/SpineEventEngine/base/pulls/comments/127707946","pull_request_review_id":50318245,"id":127707946,"diff_hunk":"@@ -0,0 +1,142 @@\n+package io.spine.validate;\n+\n+import com.google.common.collect.ImmutableList;\n+import org.hamcrest.Matchers;\n+import org.junit.Test;\n+\n+import java.util.Collection;\n+import java.util.Collections;\n+import java.util.List;\n+\n+import static com.google.common.collect.ImmutableList.of;\n+import static io.spine.test.Verify.assertNotEmpty;\n+import static org.hamcrest.MatcherAssert.assertThat;\n+import static org.junit.Assert.assertTrue;\n+\n+/**\n+ * @author Dmytro Dashenkov\n+ */\n+public abstract class FieldValidatorShould<V> {\n+\n+    /**\n+     * Creates a {@link FieldValidator} for a repeated required validated field.\n+     *\n+     * <p>The proto description of this field looks as follows:\n+     * {repeated T field_name = 42 [(required) = true, (valid) = true];}, where {@code T} is\n+     * the type parameter of the tested {@link FieldValidator}.\n+     *\n+     * @param values the list of the field values\n+     * @return new instance of {@link FieldValidator}\n+     */\n+    protected abstract FieldValidator<V> validatedRequiredRepeatedFieldValidator(List<V> values);\n+\n+    /**\n+     * Creates a {@link FieldValidator} for a repeated required but not validated field.","path":"base/src/test/java/io/spine/validate/FieldValidatorShould.java","position":34,"original_position":34,"commit_id":"a25e7e7230619f747a3e50843321d788057a9d11","original_commit_id":"a25e7e7230619f747a3e50843321d788057a9d11","user":{"login":"armiol","id":82468,"avatar_url":"https://avatars4.githubusercontent.com/u/82468?v=4","gravatar_id":"","url":"https://api.github.com/users/armiol","html_url":"https://github.com/armiol","followers_url":"https://api.github.com/users/armiol/followers","following_url":"https://api.github.com/users/armiol/following{/other_user}","gists_url":"https://api.github.com/users/armiol/gists{/gist_id}","starred_url":"https://api.github.com/users/armiol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armiol/subscriptions","organizations_url":"https://api.github.com/users/armiol/orgs","repos_url":"https://api.github.com/users/armiol/repos","events_url":"https://api.github.com/users/armiol/events{/privacy}","received_events_url":"https://api.github.com/users/armiol/received_events","type":"User","site_admin":false},"body":"`for a repeated required field, which child items are not validated separately.`","created_at":"2017-07-17T13:32:00Z","updated_at":"2017-07-17T13:36:13Z","html_url":"https://github.com/SpineEventEngine/base/pull/9#discussion_r127707946","pull_request_url":"https://api.github.com/repos/SpineEventEngine/base/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/SpineEventEngine/base/pulls/comments/127707946"},"html":{"href":"https://github.com/SpineEventEngine/base/pull/9#discussion_r127707946"},"pull_request":{"href":"https://api.github.com/repos/SpineEventEngine/base/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/SpineEventEngine/base/pulls/9","id":130413008,"html_url":"https://github.com/SpineEventEngine/base/pull/9","diff_url":"https://github.com/SpineEventEngine/base/pull/9.diff","patch_url":"https://github.com/SpineEventEngine/base/pull/9.patch","issue_url":"https://api.github.com/repos/SpineEventEngine/base/issues/9","number":9,"state":"open","locked":false,"title":"Repeated fields validation","user":{"login":"dmdashenkov","id":18305364,"avatar_url":"https://avatars5.githubusercontent.com/u/18305364?v=4","gravatar_id":"","url":"https://api.github.com/users/dmdashenkov","html_url":"https://github.com/dmdashenkov","followers_url":"https://api.github.com/users/dmdashenkov/followers","following_url":"https://api.github.com/users/dmdashenkov/following{/other_user}","gists_url":"https://api.github.com/users/dmdashenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/dmdashenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmdashenkov/subscriptions","organizations_url":"https://api.github.com/users/dmdashenkov/orgs","repos_url":"https://api.github.com/users/dmdashenkov/repos","events_url":"https://api.github.com/users/dmdashenkov/events{/privacy}","received_events_url":"https://api.github.com/users/dmdashenkov/received_events","type":"User","site_admin":false},"body":"From now, the custom `Message` field options will be applied only to those `repeated` fields which are declared as `valid`.\r\n\r\n#### Example\r\n```protobuf\r\nmessage Customer {\r\n    // The validation is applied to all the elements of the repeated field.\r\n    repeated string contact_name = 1 [(valid) = true, (pattern).regex = \".+\\\\s+.+\", (required) = true];\r\n   \r\n    // The validation is applied to the values of the map field.\r\n    map<string, people.PersonName> position_in_company = 2 [(valid) = true];\r\n\r\n    // The validation is applied to the signular fields anyway.\r\n    google.ptotobuf.Timestamp established = 3 [(when).in = PAST];\r\n}\r\n```\r\n\r\nNote, that if a `repeated` or `map` field is declared as `required` (e.g. `Customer.contact_name`), the elements of it may be _default_ by themselves. For example `customerVBuilder.addContactName(\"\")` is not a constaint violation.\r\n\r\n#### Also in this PR:\r\n\r\n - the repository code style settings are synchronized with the `core-java` ones;\r\n - a few validation bugs are fixed;\r\n - some tests for the `FieldValidator`s and `ValidatingBuilder`s are added.\r\n","created_at":"2017-07-13T16:25:29Z","updated_at":"2017-07-17T13:36:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c06861d9c6015c6dce7802f7a150dfdda524d02c","assignee":{"login":"dmdashenkov","id":18305364,"avatar_url":"https://avatars5.githubusercontent.com/u/18305364?v=4","gravatar_id":"","url":"https://api.github.com/users/dmdashenkov","html_url":"https://github.com/dmdashenkov","followers_url":"https://api.github.com/users/dmdashenkov/followers","following_url":"https://api.github.com/users/dmdashenkov/following{/other_user}","gists_url":"https://api.github.com/users/dmdashenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/dmdashenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmdashenkov/subscriptions","organizations_url":"https://api.github.com/users/dmdashenkov/orgs","repos_url":"https://api.github.com/users/dmdashenkov/repos","events_url":"https://api.github.com/users/dmdashenkov/events{/privacy}","received_events_url":"https://api.github.com/users/dmdashenkov/received_events","type":"User","site_admin":false},"assignees":[{"login":"dmdashenkov","id":18305364,"avatar_url":"https://avatars5.githubusercontent.com/u/18305364?v=4","gravatar_id":"","url":"https://api.github.com/users/dmdashenkov","html_url":"https://github.com/dmdashenkov","followers_url":"https://api.github.com/users/dmdashenkov/followers","following_url":"https://api.github.com/users/dmdashenkov/following{/other_user}","gists_url":"https://api.github.com/users/dmdashenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/dmdashenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmdashenkov/subscriptions","organizations_url":"https://api.github.com/users/dmdashenkov/orgs","repos_url":"https://api.github.com/users/dmdashenkov/repos","events_url":"https://api.github.com/users/dmdashenkov/events{/privacy}","received_events_url":"https://api.github.com/users/dmdashenkov/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/SpineEventEngine/base/pulls/9/commits","review_comments_url":"https://api.github.com/repos/SpineEventEngine/base/pulls/9/comments","review_comment_url":"https://api.github.com/repos/SpineEventEngine/base/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SpineEventEngine/base/issues/9/comments","statuses_url":"https://api.github.com/repos/SpineEventEngine/base/statuses/a25e7e7230619f747a3e50843321d788057a9d11","head":{"label":"SpineEventEngine:repeated_fields_validation","ref":"repeated_fields_validation","sha":"a25e7e7230619f747a3e50843321d788057a9d11","user":{"login":"SpineEventEngine","id":12821626,"avatar_url":"https://avatars7.githubusercontent.com/u/12821626?v=4","gravatar_id":"","url":"https://api.github.com/users/SpineEventEngine","html_url":"https://github.com/SpineEventEngine","followers_url":"https://api.github.com/users/SpineEventEngine/followers","following_url":"https://api.github.com/users/SpineEventEngine/following{/other_user}","gists_url":"https://api.github.com/users/SpineEventEngine/gists{/gist_id}","starred_url":"https://api.github.com/users/SpineEventEngine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpineEventEngine/subscriptions","organizations_url":"https://api.github.com/users/SpineEventEngine/orgs","repos_url":"https://api.github.com/users/SpineEventEngine/repos","events_url":"https://api.github.com/users/SpineEventEngine/events{/privacy}","received_events_url":"https://api.github.com/users/SpineEventEngine/received_events","type":"Organization","site_admin":false},"repo":{"id":94763465,"name":"base","full_name":"SpineEventEngine/base","owner":{"login":"SpineEventEngine","id":12821626,"avatar_url":"https://avatars7.githubusercontent.com/u/12821626?v=4","gravatar_id":"","url":"https://api.github.com/users/SpineEventEngine","html_url":"https://github.com/SpineEventEngine","followers_url":"https://api.github.com/users/SpineEventEngine/followers","following_url":"https://api.github.com/users/SpineEventEngine/following{/other_user}","gists_url":"https://api.github.com/users/SpineEventEngine/gists{/gist_id}","starred_url":"https://api.github.com/users/SpineEventEngine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpineEventEngine/subscriptions","organizations_url":"https://api.github.com/users/SpineEventEngine/orgs","repos_url":"https://api.github.com/users/SpineEventEngine/repos","events_url":"https://api.github.com/users/SpineEventEngine/events{/privacy}","received_events_url":"https://api.github.com/users/SpineEventEngine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SpineEventEngine/base","description":"The framework's base data types and utilities.","fork":false,"url":"https://api.github.com/repos/SpineEventEngine/base","forks_url":"https://api.github.com/repos/SpineEventEngine/base/forks","keys_url":"https://api.github.com/repos/SpineEventEngine/base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SpineEventEngine/base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SpineEventEngine/base/teams","hooks_url":"https://api.github.com/repos/SpineEventEngine/base/hooks","issue_events_url":"https://api.github.com/repos/SpineEventEngine/base/issues/events{/number}","events_url":"https://api.github.com/repos/SpineEventEngine/base/events","assignees_url":"https://api.github.com/repos/SpineEventEngine/base/assignees{/user}","branches_url":"https://api.github.com/repos/SpineEventEngine/base/branches{/branch}","tags_url":"https://api.github.com/repos/SpineEventEngine/base/tags","blobs_url":"https://api.github.com/repos/SpineEventEngine/base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SpineEventEngine/base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SpineEventEngine/base/git/refs{/sha}","trees_url":"https://api.github.com/repos/SpineEventEngine/base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SpineEventEngine/base/statuses/{sha}","languages_url":"https://api.github.com/repos/SpineEventEngine/base/languages","stargazers_url":"https://api.github.com/repos/SpineEventEngine/base/stargazers","contributors_url":"https://api.github.com/repos/SpineEventEngine/base/contributors","subscribers_url":"https://api.github.com/repos/SpineEventEngine/base/subscribers","subscription_url":"https://api.github.com/repos/SpineEventEngine/base/subscription","commits_url":"https://api.github.com/repos/SpineEventEngine/base/commits{/sha}","git_commits_url":"https://api.github.com/repos/SpineEventEngine/base/git/commits{/sha}","comments_url":"https://api.github.com/repos/SpineEventEngine/base/comments{/number}","issue_comment_url":"https://api.github.com/repos/SpineEventEngine/base/issues/comments{/number}","contents_url":"https://api.github.com/repos/SpineEventEngine/base/contents/{+path}","compare_url":"https://api.github.com/repos/SpineEventEngine/base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SpineEventEngine/base/merges","archive_url":"https://api.github.com/repos/SpineEventEngine/base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SpineEventEngine/base/downloads","issues_url":"https://api.github.com/repos/SpineEventEngine/base/issues{/number}","pulls_url":"https://api.github.com/repos/SpineEventEngine/base/pulls{/number}","milestones_url":"https://api.github.com/repos/SpineEventEngine/base/milestones{/number}","notifications_url":"https://api.github.com/repos/SpineEventEngine/base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SpineEventEngine/base/labels{/name}","releases_url":"https://api.github.com/repos/SpineEventEngine/base/releases{/id}","deployments_url":"https://api.github.com/repos/SpineEventEngine/base/deployments","created_at":"2017-06-19T10:08:29Z","updated_at":"2017-06-27T19:00:13Z","pushed_at":"2017-07-17T13:26:34Z","git_url":"git://github.com/SpineEventEngine/base.git","ssh_url":"git@github.com:SpineEventEngine/base.git","clone_url":"https://github.com/SpineEventEngine/base.git","svn_url":"https://github.com/SpineEventEngine/base","homepage":null,"size":649,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"SpineEventEngine:master","ref":"master","sha":"d3bf4820d1582ba76c1da4219b5815ec03f123f4","user":{"login":"SpineEventEngine","id":12821626,"avatar_url":"https://avatars7.githubusercontent.com/u/12821626?v=4","gravatar_id":"","url":"https://api.github.com/users/SpineEventEngine","html_url":"https://github.com/SpineEventEngine","followers_url":"https://api.github.com/users/SpineEventEngine/followers","following_url":"https://api.github.com/users/SpineEventEngine/following{/other_user}","gists_url":"https://api.github.com/users/SpineEventEngine/gists{/gist_id}","starred_url":"https://api.github.com/users/SpineEventEngine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpineEventEngine/subscriptions","organizations_url":"https://api.github.com/users/SpineEventEngine/orgs","repos_url":"https://api.github.com/users/SpineEventEngine/repos","events_url":"https://api.github.com/users/SpineEventEngine/events{/privacy}","received_events_url":"https://api.github.com/users/SpineEventEngine/received_events","type":"Organization","site_admin":false},"repo":{"id":94763465,"name":"base","full_name":"SpineEventEngine/base","owner":{"login":"SpineEventEngine","id":12821626,"avatar_url":"https://avatars7.githubusercontent.com/u/12821626?v=4","gravatar_id":"","url":"https://api.github.com/users/SpineEventEngine","html_url":"https://github.com/SpineEventEngine","followers_url":"https://api.github.com/users/SpineEventEngine/followers","following_url":"https://api.github.com/users/SpineEventEngine/following{/other_user}","gists_url":"https://api.github.com/users/SpineEventEngine/gists{/gist_id}","starred_url":"https://api.github.com/users/SpineEventEngine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpineEventEngine/subscriptions","organizations_url":"https://api.github.com/users/SpineEventEngine/orgs","repos_url":"https://api.github.com/users/SpineEventEngine/repos","events_url":"https://api.github.com/users/SpineEventEngine/events{/privacy}","received_events_url":"https://api.github.com/users/SpineEventEngine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SpineEventEngine/base","description":"The framework's base data types and utilities.","fork":false,"url":"https://api.github.com/repos/SpineEventEngine/base","forks_url":"https://api.github.com/repos/SpineEventEngine/base/forks","keys_url":"https://api.github.com/repos/SpineEventEngine/base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SpineEventEngine/base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SpineEventEngine/base/teams","hooks_url":"https://api.github.com/repos/SpineEventEngine/base/hooks","issue_events_url":"https://api.github.com/repos/SpineEventEngine/base/issues/events{/number}","events_url":"https://api.github.com/repos/SpineEventEngine/base/events","assignees_url":"https://api.github.com/repos/SpineEventEngine/base/assignees{/user}","branches_url":"https://api.github.com/repos/SpineEventEngine/base/branches{/branch}","tags_url":"https://api.github.com/repos/SpineEventEngine/base/tags","blobs_url":"https://api.github.com/repos/SpineEventEngine/base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SpineEventEngine/base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SpineEventEngine/base/git/refs{/sha}","trees_url":"https://api.github.com/repos/SpineEventEngine/base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SpineEventEngine/base/statuses/{sha}","languages_url":"https://api.github.com/repos/SpineEventEngine/base/languages","stargazers_url":"https://api.github.com/repos/SpineEventEngine/base/stargazers","contributors_url":"https://api.github.com/repos/SpineEventEngine/base/contributors","subscribers_url":"https://api.github.com/repos/SpineEventEngine/base/subscribers","subscription_url":"https://api.github.com/repos/SpineEventEngine/base/subscription","commits_url":"https://api.github.com/repos/SpineEventEngine/base/commits{/sha}","git_commits_url":"https://api.github.com/repos/SpineEventEngine/base/git/commits{/sha}","comments_url":"https://api.github.com/repos/SpineEventEngine/base/comments{/number}","issue_comment_url":"https://api.github.com/repos/SpineEventEngine/base/issues/comments{/number}","contents_url":"https://api.github.com/repos/SpineEventEngine/base/contents/{+path}","compare_url":"https://api.github.com/repos/SpineEventEngine/base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SpineEventEngine/base/merges","archive_url":"https://api.github.com/repos/SpineEventEngine/base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SpineEventEngine/base/downloads","issues_url":"https://api.github.com/repos/SpineEventEngine/base/issues{/number}","pulls_url":"https://api.github.com/repos/SpineEventEngine/base/pulls{/number}","milestones_url":"https://api.github.com/repos/SpineEventEngine/base/milestones{/number}","notifications_url":"https://api.github.com/repos/SpineEventEngine/base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SpineEventEngine/base/labels{/name}","releases_url":"https://api.github.com/repos/SpineEventEngine/base/releases{/id}","deployments_url":"https://api.github.com/repos/SpineEventEngine/base/deployments","created_at":"2017-06-19T10:08:29Z","updated_at":"2017-06-27T19:00:13Z","pushed_at":"2017-07-17T13:26:34Z","git_url":"git://github.com/SpineEventEngine/base.git","ssh_url":"git@github.com:SpineEventEngine/base.git","clone_url":"https://github.com/SpineEventEngine/base.git","svn_url":"https://github.com/SpineEventEngine/base","homepage":null,"size":649,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SpineEventEngine/base/pulls/9"},"html":{"href":"https://github.com/SpineEventEngine/base/pull/9"},"issue":{"href":"https://api.github.com/repos/SpineEventEngine/base/issues/9"},"comments":{"href":"https://api.github.com/repos/SpineEventEngine/base/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/SpineEventEngine/base/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/SpineEventEngine/base/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SpineEventEngine/base/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/SpineEventEngine/base/statuses/a25e7e7230619f747a3e50843321d788057a9d11"}}}}
{"actor":{"display_login":"armiol"}}