{"action":"created","issue":{"url":"https://api.github.com/repos/alexfedoseev/re-formality/issues/10","repository_url":"https://api.github.com/repos/alexfedoseev/re-formality","labels_url":"https://api.github.com/repos/alexfedoseev/re-formality/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/alexfedoseev/re-formality/issues/10/comments","events_url":"https://api.github.com/repos/alexfedoseev/re-formality/issues/10/events","html_url":"https://github.com/alexfedoseev/re-formality/issues/10","id":305713578,"number":10,"title":"Support for complex field types","user":{"login":"kgoggin","id":4549617,"avatar_url":"https://avatars1.githubusercontent.com/u/4549617?v=4","gravatar_id":"","url":"https://api.github.com/users/kgoggin","html_url":"https://github.com/kgoggin","followers_url":"https://api.github.com/users/kgoggin/followers","following_url":"https://api.github.com/users/kgoggin/following{/other_user}","gists_url":"https://api.github.com/users/kgoggin/gists{/gist_id}","starred_url":"https://api.github.com/users/kgoggin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgoggin/subscriptions","organizations_url":"https://api.github.com/users/kgoggin/orgs","repos_url":"https://api.github.com/users/kgoggin/repos","events_url":"https://api.github.com/users/kgoggin/events{/privacy}","received_events_url":"https://api.github.com/users/kgoggin/received_events","type":"User","site_admin":false},"labels":[{"id":768258560,"url":"https://api.github.com/repos/alexfedoseev/re-formality/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-15T20:46:54Z","updated_at":"2018-03-16T15:54:08Z","closed_at":null,"author_association":"NONE","body":"Based on my understanding of how things are set up, it looks like you can only have fields of type `string`, as that's the type of `Formality__Validation__value`, and the `get` method must return that type. It'd be really great to support more complex types. For example: a group of checkboxes whose value is represented in state as an array of the string values of the selected options. \r\n\r\nI noticed you have a \"TODO\" comment alongside that type definition so I'm guessing you've already thought of this. By using a variant there, I assume you'd seek to constrain the options available (string, int, bool, etc.)?"},"comment":{"url":"https://api.github.com/repos/alexfedoseev/re-formality/issues/comments/373757842","html_url":"https://github.com/alexfedoseev/re-formality/issues/10#issuecomment-373757842","issue_url":"https://api.github.com/repos/alexfedoseev/re-formality/issues/10","id":373757842,"user":{"login":"alexfedoseev","id":4244251,"avatar_url":"https://avatars0.githubusercontent.com/u/4244251?v=4","gravatar_id":"","url":"https://api.github.com/users/alexfedoseev","html_url":"https://github.com/alexfedoseev","followers_url":"https://api.github.com/users/alexfedoseev/followers","following_url":"https://api.github.com/users/alexfedoseev/following{/other_user}","gists_url":"https://api.github.com/users/alexfedoseev/gists{/gist_id}","starred_url":"https://api.github.com/users/alexfedoseev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexfedoseev/subscriptions","organizations_url":"https://api.github.com/users/alexfedoseev/orgs","repos_url":"https://api.github.com/users/alexfedoseev/repos","events_url":"https://api.github.com/users/alexfedoseev/events{/privacy}","received_events_url":"https://api.github.com/users/alexfedoseev/received_events","type":"User","site_admin":false},"created_at":"2018-03-16T15:54:08Z","updated_at":"2018-03-16T15:54:08Z","author_association":"OWNER","body":"> OTOH if you go with the basic variant you're likely to just keep having to add options to it as people encounter different use cases.\r\n\r\nYeah, this is exactly the reason why I haven't implemented it yet. It's like rabbit hole. Also, every user gets perf penalty due to allocations, even if they don't need anything but string.\r\n\r\n> It seems ideal to be able to let the user define the type, but also like that might add a lot of complexity.\r\n\r\nI just checked sources real quick and it seems delegating value definition to user is not a big issue. Formality (almost) doesn't care about the value itself, it just passes things around. The only thing that abstraction cares about is `validationResult`. The rest is just abstract types.\r\n\r\nThe only thing I need in this case tho is the way to find out if value is _empty_ (to avoid emitting success on empty values, #9), but I can ask user to define this function for me in config, e.g.:\r\n\r\n```reason\r\n/* type */\r\nlet isEmpty = value => bool;\r\n\r\n/* config */\r\nlet isEmpty = value => value === \"\";\r\n```\r\n\r\nI'll look into this soon, shouldn't take a long (famous last words 😂)"}}
{"actor":{"display_login":"alexfedoseev"}}