{"action":"created","issue":{"url":"https://api.github.com/repos/zwilias/json-decode-exploration/issues/1","repository_url":"https://api.github.com/repos/zwilias/json-decode-exploration","labels_url":"https://api.github.com/repos/zwilias/json-decode-exploration/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/zwilias/json-decode-exploration/issues/1/comments","events_url":"https://api.github.com/repos/zwilias/json-decode-exploration/issues/1/events","html_url":"https://github.com/zwilias/json-decode-exploration/issues/1","id":276966391,"number":1,"title":"Be able to deliberately ignore fields?","user":{"login":"michaeljones","id":5390,"avatar_url":"https://avatars0.githubusercontent.com/u/5390?v=4","gravatar_id":"","url":"https://api.github.com/users/michaeljones","html_url":"https://github.com/michaeljones","followers_url":"https://api.github.com/users/michaeljones/followers","following_url":"https://api.github.com/users/michaeljones/following{/other_user}","gists_url":"https://api.github.com/users/michaeljones/gists{/gist_id}","starred_url":"https://api.github.com/users/michaeljones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaeljones/subscriptions","organizations_url":"https://api.github.com/users/michaeljones/orgs","repos_url":"https://api.github.com/users/michaeljones/repos","events_url":"https://api.github.com/users/michaeljones/events{/privacy}","received_events_url":"https://api.github.com/users/michaeljones/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-11-27T10:21:46Z","updated_at":"2017-11-27T14:58:17Z","closed_at":null,"author_association":"NONE","body":"I think it might be helpful to have an 'ignore' function in the Pipeline API and maybe the simple one. Not 100% sure what it would look like but sometimes there are fields that I know are there but I don't want to decode and I don't want warnings about them either. \r\n\r\nI could check the warnings and make sure they are what I expect but it seems like it would be easier to declare what fields I'd like to ignore in the decoders themselves:\r\n\r\n```elm\r\ndecode MyData\r\n  |> required \"id\" int\r\n  |> required \"value\" bool\r\n  |> ignore \"type\"\r\n```\r\n\r\nDoes that seem reasonable? Or is there perhaps an easy way to achieve it already?\r\n\r\n---\r\n\r\nIt seems this does the trick:\r\n\r\n```elm\r\nignore : String -> Decode.Decoder a -> Decode.Decoder b -> Decode.Decoder b\r\nignore key valueDecoder decoder =\r\n    Decode.field key valueDecoder\r\n        |> Decode.andThen (\\_ -> decoder)\r\n\r\n\r\nignoreAt : List String -> Decode.Decoder a -> Decode.Decoder b -> Decode.Decoder b\r\nignoreAt path valueDecoder decoder =\r\n    Decode.at path valueDecoder\r\n        |> Decode.andThen (\\_ -> decoder)\r\n```\r\nI guess it is up to your opinion on API design. I think this might be quite useful to have but as it is easily achievable with the current tools then maybe there is a argument that it is redundant.\r\n\r\nThough they required you to specify the decoder for the field value, though that could be avoided by using the value decoder I guess. Probably side on having more type safety than less!"},"comment":{"url":"https://api.github.com/repos/zwilias/json-decode-exploration/issues/comments/347207440","html_url":"https://github.com/zwilias/json-decode-exploration/issues/1#issuecomment-347207440","issue_url":"https://api.github.com/repos/zwilias/json-decode-exploration/issues/1","id":347207440,"user":{"login":"michaeljones","id":5390,"avatar_url":"https://avatars0.githubusercontent.com/u/5390?v=4","gravatar_id":"","url":"https://api.github.com/users/michaeljones","html_url":"https://github.com/michaeljones","followers_url":"https://api.github.com/users/michaeljones/followers","following_url":"https://api.github.com/users/michaeljones/following{/other_user}","gists_url":"https://api.github.com/users/michaeljones/gists{/gist_id}","starred_url":"https://api.github.com/users/michaeljones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaeljones/subscriptions","organizations_url":"https://api.github.com/users/michaeljones/orgs","repos_url":"https://api.github.com/users/michaeljones/repos","events_url":"https://api.github.com/users/michaeljones/events{/privacy}","received_events_url":"https://api.github.com/users/michaeljones/received_events","type":"User","site_admin":false},"created_at":"2017-11-27T14:58:17Z","updated_at":"2017-11-27T14:58:17Z","author_association":"NONE","body":"Sounds great! That API looks very nice. I don't enjoy the verbosity of dealing with simple 'string' -> 'union type' decoding at the moment.\r\n\r\nI'd almost be tempted to implement a `ifCheck` or `checkThen` or something which would shortcut the need for the `|> map (always` but it does start to be diminishing returns at some point. \r\n\r\nThanks for the quick responses. Happy to be helping. This library is proving very useful for us so I'm grateful. "}}
{"actor":{"display_login":"michaeljones"}}