{"action":"created","issue":{"url":"https://api.github.com/repos/go-playground/mold/issues/2","repository_url":"https://api.github.com/repos/go-playground/mold","labels_url":"https://api.github.com/repos/go-playground/mold/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/go-playground/mold/issues/2/comments","events_url":"https://api.github.com/repos/go-playground/mold/issues/2/events","html_url":"https://github.com/go-playground/mold/issues/2","id":300824879,"number":2,"title":"question: plans to port validator on top of this?","user":{"login":"ansel1","id":107825,"avatar_url":"https://avatars0.githubusercontent.com/u/107825?v=4","gravatar_id":"","url":"https://api.github.com/users/ansel1","html_url":"https://github.com/ansel1","followers_url":"https://api.github.com/users/ansel1/followers","following_url":"https://api.github.com/users/ansel1/following{/other_user}","gists_url":"https://api.github.com/users/ansel1/gists{/gist_id}","starred_url":"https://api.github.com/users/ansel1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansel1/subscriptions","organizations_url":"https://api.github.com/users/ansel1/orgs","repos_url":"https://api.github.com/users/ansel1/repos","events_url":"https://api.github.com/users/ansel1/events{/privacy}","received_events_url":"https://api.github.com/users/ansel1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-27T22:54:35Z","updated_at":"2018-02-28T17:14:18Z","closed_at":null,"author_association":"NONE","body":"Seems like the Transform is a refactoring of the basic struct traversal logic from validator.  Was thinking it would be really useful to have a re-usable struct visitor library like this, to build focussed struct processing packages, like one which sets default values, initializes values from environment variables, or validates.\r\n\r\nOne thing I see missing from mold, which validator uses, is that the Func doesn't know where it is in the hierarchy, so it isn't possible to include that information in error messages or validation problems.  \r\n\r\nI'm interested in the idea of building other types of struct processors on top of this core because I use a number of them currently, and they are all slightly different in how they work.  For example, whether they allow setting the tag name, what they do with fields with no tags, how many tag names that package uses, how they traverse embedded structs, which types they handle, etc.  Would be really nice to have a core traversal logic which encouraged some patterns, like one (configurable) tag per package/processor, consistent handling of untagged fields, etc."},"comment":{"url":"https://api.github.com/repos/go-playground/mold/issues/comments/369311726","html_url":"https://github.com/go-playground/mold/issues/2#issuecomment-369311726","issue_url":"https://api.github.com/repos/go-playground/mold/issues/2","id":369311726,"user":{"login":"joeybloggs","id":8068371,"avatar_url":"https://avatars0.githubusercontent.com/u/8068371?v=4","gravatar_id":"","url":"https://api.github.com/users/joeybloggs","html_url":"https://github.com/joeybloggs","followers_url":"https://api.github.com/users/joeybloggs/followers","following_url":"https://api.github.com/users/joeybloggs/following{/other_user}","gists_url":"https://api.github.com/users/joeybloggs/gists{/gist_id}","starred_url":"https://api.github.com/users/joeybloggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeybloggs/subscriptions","organizations_url":"https://api.github.com/users/joeybloggs/orgs","repos_url":"https://api.github.com/users/joeybloggs/repos","events_url":"https://api.github.com/users/joeybloggs/events{/privacy}","received_events_url":"https://api.github.com/users/joeybloggs/received_events","type":"User","site_admin":false},"created_at":"2018-02-28T17:14:18Z","updated_at":"2018-02-28T17:14:18Z","author_association":"CONTRIBUTOR","body":"Hey @ansel1 Transform is more like if [form](https://github.com/go-playground/form) and [validator](https://github.com/go-playground/validator) had a code baby ;)\r\n\r\nI had the same thought after creating this library, I just haven't been able to think of a way to consolidate the logic as libraries that need to set data, like form and mold, vs only need to read, like validator, behave very differently eg. https://github.com/go-playground/mold/blob/v2/mold.go#L230-L253\r\n\r\nnot to mention the caching layers are completely different, even though they do share a lot of information.\r\n\r\nthen there's differentiating between errors eg. is it a Validation vs Set\r\n\r\nand consolidating to one tag might not be as straightforward as that, what if I wanted to skip validation, but not the set of data from say an ENV variable?\r\n\r\nI'm sure it could be done somehow, however, I'm not sure that I want to as each of the libraries works great independently and can be configured independently and in any configuration/order you want to.\r\n\r\nlet me think about it for a while though I might be able to make it all come together."}}
{"actor":{"display_login":"joeybloggs"}}