{"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":6,"created_at":"2015-08-31T13:49:58Z","updated_at":"2015-09-25T17:18:31Z","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/143292267","html_url":"https://github.com/linkedin/goavro/pull/26#issuecomment-143292267","issue_url":"https://api.github.com/repos/linkedin/goavro/issues/26","id":143292267,"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},"created_at":"2015-09-25T17:18:31Z","updated_at":"2015-09-25T17:18:31Z","body":"Sorry. I've edited the comment after submitting, but the email was not\nupdated.\nThe code is https://gist.github.com/lixin9311/6e117363d1b709b8411e\n2015年9月25日 21:40，\"Karrick McDermott\" <notifications@github.com>写道：\n\n> Your example code gave me a 404.\n>\n> I don't expect you to be able to rewrite your company schema. I know you\n> may not be able to do that. Could you provide an example that demonstrates\n> the problem you are having? The code change we did earlier was to create a\n> default value of nil for various types. Do you have a schema example, and\n> perhaps a failing test function that demonstrates this problem? I'd love to\n> wrap this up and get it fixed for good.\n>\n> -Karrick\n>\n> On Fri, Sep 25, 2015 at 1:16 AM, lixin9311 <notifications@github.com>\n> 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>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/linkedin/goavro/pull/26#issuecomment-143227444>.\n>\n"}}