{"action":"created","issue":{"url":"https://api.github.com/repos/typesafehub/config/issues/399","repository_url":"https://api.github.com/repos/typesafehub/config","labels_url":"https://api.github.com/repos/typesafehub/config/issues/399/labels{/name}","comments_url":"https://api.github.com/repos/typesafehub/config/issues/399/comments","events_url":"https://api.github.com/repos/typesafehub/config/issues/399/events","html_url":"https://github.com/typesafehub/config/issues/399","id":157265566,"number":399,"title":"Add Support for Optional Bean Properties","user":{"login":"karthicks","id":1120120,"avatar_url":"https://avatars.githubusercontent.com/u/1120120?v=3","gravatar_id":"","url":"https://api.github.com/users/karthicks","html_url":"https://github.com/karthicks","followers_url":"https://api.github.com/users/karthicks/followers","following_url":"https://api.github.com/users/karthicks/following{/other_user}","gists_url":"https://api.github.com/users/karthicks/gists{/gist_id}","starred_url":"https://api.github.com/users/karthicks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karthicks/subscriptions","organizations_url":"https://api.github.com/users/karthicks/orgs","repos_url":"https://api.github.com/users/karthicks/repos","events_url":"https://api.github.com/users/karthicks/events{/privacy}","received_events_url":"https://api.github.com/users/karthicks/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-05-27T18:30:35Z","updated_at":"2016-05-27T23:10:14Z","closed_at":null,"body":"Currently, a config bean cannot define a property which is optional, in the sense that it need not necessarily have a value. This prevents us from using the `ConfigBeanFactory` for such config beans, where the optional property is actually supposed to be `null`.\r\n\r\nTo address this use case, I propose that we annotate the optional property as such, so that the bean factory does not raise a validation error, in the event that property happens to be missing. Specifically, let's define an annotation called `Optional` to indicate whether the annotated field is optional. In general, one can use annotations to suppress or express all kinds of validation rules, such as whether the property is an `Email` or a `PhoneNumber`, and so on.\r\n\r\nTo illustrate this, consider the following bean, which contains an optional property called `nullableValue`.\r\n```\r\n    public static class ValueObject {\r\n        @Optional\r\n        private String nullableValue;\r\n        private String nonNullableValue;\r\n    }\r\n    private ValueObject valueObject;\r\n```\r\n\r\nOne should be able to configure this object like so:\r\n```\r\n    \"objects\" : {\r\n      \"valueObject\": {\r\n        \"nonNullableValue\": \"nonNullValue\"\r\n      }\r\n    }\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/typesafehub/config/issues/comments/222272166","html_url":"https://github.com/typesafehub/config/issues/399#issuecomment-222272166","issue_url":"https://api.github.com/repos/typesafehub/config/issues/399","id":222272166,"user":{"login":"havocp","id":218689,"avatar_url":"https://avatars.githubusercontent.com/u/218689?v=3","gravatar_id":"","url":"https://api.github.com/users/havocp","html_url":"https://github.com/havocp","followers_url":"https://api.github.com/users/havocp/followers","following_url":"https://api.github.com/users/havocp/following{/other_user}","gists_url":"https://api.github.com/users/havocp/gists{/gist_id}","starred_url":"https://api.github.com/users/havocp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/havocp/subscriptions","organizations_url":"https://api.github.com/users/havocp/orgs","repos_url":"https://api.github.com/users/havocp/repos","events_url":"https://api.github.com/users/havocp/events{/privacy}","received_events_url":"https://api.github.com/users/havocp/received_events","type":"User","site_admin":false},"created_at":"2016-05-27T23:10:14Z","updated_at":"2016-05-27T23:10:14Z","body":"you may find the two bugs linked from https://github.com/typesafehub/config/pull/286 have relevant discussion (I'm not sure, can't look in detail right now)"}}
{"actor":{"display_login":"havocp"}}