{"action":"created","issue":{"url":"https://api.github.com/repos/linkedin/goavro/issues/26","labels_url":"https://api.github.com/repos/linkedin/goavro/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/linkedin/goavro/issues/26/comments","events_url":"https://api.github.com/repos/linkedin/goavro/issues/26/events","html_url":"https://github.com/linkedin/goavro/pull/26","id":104057258,"number":26,"title":"Fix bug assign nil to null type in union type","user":{"login":"lixin9311","id":371475,"avatar_url":"https://avatars.githubusercontent.com/u/371475?v=3","gravatar_id":"","url":"https://api.github.com/users/lixin9311","html_url":"https://github.com/lixin9311","followers_url":"https://api.github.com/users/lixin9311/followers","following_url":"https://api.github.com/users/lixin9311/following{/other_user}","gists_url":"https://api.github.com/users/lixin9311/gists{/gist_id}","starred_url":"https://api.github.com/users/lixin9311/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lixin9311/subscriptions","organizations_url":"https://api.github.com/users/lixin9311/orgs","repos_url":"https://api.github.com/users/lixin9311/repos","events_url":"https://api.github.com/users/lixin9311/events{/privacy}","received_events_url":"https://api.github.com/users/lixin9311/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-31T13:49:58Z","updated_at":"2015-09-25T13:40:40Z","closed_at":"2015-09-11T19:31:07Z","pull_request":{"url":"https://api.github.com/repos/linkedin/goavro/pulls/26","html_url":"https://github.com/linkedin/goavro/pull/26","diff_url":"https://github.com/linkedin/goavro/pull/26.diff","patch_url":"https://github.com/linkedin/goavro/pull/26.patch"},"body":"My problem:\r\nCannot assign nil or just left it to be nil to a null type in union type with schema like this:\r\n{\r\nname'type': 'record',\r\n'name': 'Msg',\r\n'fields' : [\r\n{'name': 'value', 'type': ['string', 'null']}\r\n]}\r\nIt will say \"no data and default value\"\r\nBecause line 598 of codec.go\r\nfield.Datum = nil\r\nreflect.ValueOf(field.Datum).IsValid() == false"},"comment":{"url":"https://api.github.com/repos/linkedin/goavro/issues/comments/143227444","html_url":"https://github.com/linkedin/goavro/pull/26#issuecomment-143227444","issue_url":"https://api.github.com/repos/linkedin/goavro/issues/26","id":143227444,"user":{"login":"karrick","id":155788,"avatar_url":"https://avatars.githubusercontent.com/u/155788?v=3","gravatar_id":"","url":"https://api.github.com/users/karrick","html_url":"https://github.com/karrick","followers_url":"https://api.github.com/users/karrick/followers","following_url":"https://api.github.com/users/karrick/following{/other_user}","gists_url":"https://api.github.com/users/karrick/gists{/gist_id}","starred_url":"https://api.github.com/users/karrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karrick/subscriptions","organizations_url":"https://api.github.com/users/karrick/orgs","repos_url":"https://api.github.com/users/karrick/repos","events_url":"https://api.github.com/users/karrick/events{/privacy}","received_events_url":"https://api.github.com/users/karrick/received_events","type":"User","site_admin":false},"created_at":"2015-09-25T13:40:40Z","updated_at":"2015-09-25T13:40:40Z","body":"Your example code gave me a 404.\n\nI don't expect you to be able to rewrite your company schema. I know you\nmay not be able to do that. Could you provide an example that demonstrates\nthe problem you are having? The code change we did earlier was to create a\ndefault value of nil for various types. Do you have a schema example, and\nperhaps a failing test function that demonstrates this problem? I'd love to\nwrap this up and get it fixed for good.\n\n-Karrick\n\nOn Fri, Sep 25, 2015 at 1:16 AM, lixin9311 <notifications@github.com> wrote:\n\n> here is the code.\n> https://gist.github.com/lixin9311/cca3eb341c798f2f9c4b\n>\n> the reason is\n> https://github.com/linkedin/goavro/blob/master/codec.go#L598-L604\n>\n> the avro schema I am using has been deployed in many projects in my\n> company, so it's very hard to rewrite the schema with optional fields or\n> fields with default value, which is the right way I believe.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/linkedin/goavro/pull/26#issuecomment-143129297>.\n>\n"}}