{"action":"created","issue":{"url":"https://api.github.com/repos/vaadin/framework/issues/10724","repository_url":"https://api.github.com/repos/vaadin/framework","labels_url":"https://api.github.com/repos/vaadin/framework/issues/10724/labels{/name}","comments_url":"https://api.github.com/repos/vaadin/framework/issues/10724/comments","events_url":"https://api.github.com/repos/vaadin/framework/issues/10724/events","html_url":"https://github.com/vaadin/framework/pull/10724","id":306110453,"number":10724,"title":"Added method asRequired with a custom required validator to BindingBuilder.","user":{"login":"marciopd","id":2352369,"avatar_url":"https://avatars2.githubusercontent.com/u/2352369?v=4","gravatar_id":"","url":"https://api.github.com/users/marciopd","html_url":"https://github.com/marciopd","followers_url":"https://api.github.com/users/marciopd/followers","following_url":"https://api.github.com/users/marciopd/following{/other_user}","gists_url":"https://api.github.com/users/marciopd/gists{/gist_id}","starred_url":"https://api.github.com/users/marciopd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marciopd/subscriptions","organizations_url":"https://api.github.com/users/marciopd/orgs","repos_url":"https://api.github.com/users/marciopd/repos","events_url":"https://api.github.com/users/marciopd/events{/privacy}","received_events_url":"https://api.github.com/users/marciopd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-17T00:11:37Z","updated_at":"2018-03-26T14:43:42Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/vaadin/framework/pulls/10724","html_url":"https://github.com/vaadin/framework/pull/10724","diff_url":"https://github.com/vaadin/framework/pull/10724.diff","patch_url":"https://github.com/vaadin/framework/pull/10724.patch"},"body":"Hello!\r\n\r\nCurrently the Binder checks if a value is required only by comparing it with `field.getEmptyValue()`.\r\n\r\nSince `value` can be something returned by a converted running before the validation, then sometimes it makes sense to consider values that are semantically empty from the model's perspective too (`null` or a null object, for instance).\r\n\r\nThis pull request makes this possible without breaking any backwards compatibility by providing a new method to specify a field as required and passing together the custom required validator to be used.\r\n\r\nIt will allow developers to customise required validation easily if needed, replacing the previous `binder.forField(...).asRequired()` call with `binder.forField(...).asRequired(myAppRequiredValidator)`.\r\n\r\nI had a conversation with @Legioth about this issue and we came together with this idea.\r\n\r\nThere are unit tests included in the PR.\r\n\r\nPlease let me know if everything is ok. Best regards!\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/vaadin/framework/10724)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/vaadin/framework/issues/comments/376190815","html_url":"https://github.com/vaadin/framework/pull/10724#issuecomment-376190815","issue_url":"https://api.github.com/repos/vaadin/framework/issues/10724","id":376190815,"user":{"login":"elmot","id":5366945,"avatar_url":"https://avatars2.githubusercontent.com/u/5366945?v=4","gravatar_id":"","url":"https://api.github.com/users/elmot","html_url":"https://github.com/elmot","followers_url":"https://api.github.com/users/elmot/followers","following_url":"https://api.github.com/users/elmot/following{/other_user}","gists_url":"https://api.github.com/users/elmot/gists{/gist_id}","starred_url":"https://api.github.com/users/elmot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elmot/subscriptions","organizations_url":"https://api.github.com/users/elmot/orgs","repos_url":"https://api.github.com/users/elmot/repos","events_url":"https://api.github.com/users/elmot/events{/privacy}","received_events_url":"https://api.github.com/users/elmot/received_events","type":"User","site_admin":false},"created_at":"2018-03-26T14:43:42Z","updated_at":"2018-03-26T14:43:42Z","author_association":"CONTRIBUTOR","body":"\n\n\n\nReviewed 1 of 2 files at r1, 1 of 1 files at r2.\nReview status: all files reviewed at latest revision, 1 unresolved discussion.\n\n---\n\n\n\n*Comments from [Reviewable](https://reviewable.io:443/reviews/vaadin/framework/10724)*\n<!-- Sent from Reviewable.io -->\n"}}
{"actor":{"display_login":"elmot"}}