{"action":"created","issue":{"url":"https://api.github.com/repos/kipcole9/money/issues/80","repository_url":"https://api.github.com/repos/kipcole9/money","labels_url":"https://api.github.com/repos/kipcole9/money/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/kipcole9/money/issues/80/comments","events_url":"https://api.github.com/repos/kipcole9/money/issues/80/events","html_url":"https://github.com/kipcole9/money/issues/80","id":363198381,"node_id":"MDU6SXNzdWUzNjMxOTgzODE=","number":80,"title":"Have an valid empty state for ecto money types","user":{"login":"LostKobrakai","id":2489835,"node_id":"MDQ6VXNlcjI0ODk4MzU=","avatar_url":"https://avatars2.githubusercontent.com/u/2489835?v=4","gravatar_id":"","url":"https://api.github.com/users/LostKobrakai","html_url":"https://github.com/LostKobrakai","followers_url":"https://api.github.com/users/LostKobrakai/followers","following_url":"https://api.github.com/users/LostKobrakai/following{/other_user}","gists_url":"https://api.github.com/users/LostKobrakai/gists{/gist_id}","starred_url":"https://api.github.com/users/LostKobrakai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LostKobrakai/subscriptions","organizations_url":"https://api.github.com/users/LostKobrakai/orgs","repos_url":"https://api.github.com/users/LostKobrakai/repos","events_url":"https://api.github.com/users/LostKobrakai/events{/privacy}","received_events_url":"https://api.github.com/users/LostKobrakai/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-09-24T15:28:29Z","updated_at":"2018-09-27T14:16:39Z","closed_at":"2018-09-27T14:15:21Z","author_association":"CONTRIBUTOR","body":"Currently when using the built in ecto types of ex_money any \"empty\" state will result in a casting error, which is hard to handle in a normal changeset flow. I'd be happy to have  the following so if both fields are empty it's not raising:\r\n`def cast(%{\"currency\" => \"\", \"amount\" => \"\"}), do: {:ok, nil}`. \r\n\r\nMaybe even:\r\n`def cast(%{\"currency\" => currency, \"amount\" => \"\"}), do: {:ok, Money.zero(currency)}`. \r\n\r\nI feel like ecto type should be preprered for empty values and just let the user explicitly require values via `validate_required/3` / `validate_change/3`."},"comment":{"url":"https://api.github.com/repos/kipcole9/money/issues/comments/425109592","html_url":"https://github.com/kipcole9/money/issues/80#issuecomment-425109592","issue_url":"https://api.github.com/repos/kipcole9/money/issues/80","id":425109592,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTEwOTU5Mg==","user":{"login":"kipcole9","id":15895,"node_id":"MDQ6VXNlcjE1ODk1","avatar_url":"https://avatars2.githubusercontent.com/u/15895?v=4","gravatar_id":"","url":"https://api.github.com/users/kipcole9","html_url":"https://github.com/kipcole9","followers_url":"https://api.github.com/users/kipcole9/followers","following_url":"https://api.github.com/users/kipcole9/following{/other_user}","gists_url":"https://api.github.com/users/kipcole9/gists{/gist_id}","starred_url":"https://api.github.com/users/kipcole9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kipcole9/subscriptions","organizations_url":"https://api.github.com/users/kipcole9/orgs","repos_url":"https://api.github.com/users/kipcole9/repos","events_url":"https://api.github.com/users/kipcole9/events{/privacy}","received_events_url":"https://api.github.com/users/kipcole9/received_events","type":"User","site_admin":false},"created_at":"2018-09-27T14:16:38Z","updated_at":"2018-09-27T14:16:38Z","author_association":"OWNER","body":"I've updated along the lines of your suggestion.  Let me know if it reflects what you were after?  If so I'll release on hex today.  Thanks again for the report and suggestion."}}
{"actor":{"display_login":"kipcole9"}}