Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema with union and NativeFromBinary() map #215

Open
rodrigobrochado opened this issue Aug 4, 2020 · 0 comments
Open

Schema with union and NativeFromBinary() map #215

rodrigobrochado opened this issue Aug 4, 2020 · 0 comments

Comments

@rodrigobrochado
Copy link

rodrigobrochado commented Aug 4, 2020

Hi @karrick (I'm hoping you are still around here)

I saw that you've strictly followed the Avro specification in order to develop/maintain this go module. About the JSON encoding, I've seen some complaining about the TextualFromNative() inserting types fields for union Avro types (i.e. #167 and #106). For what I've seen on the specification, these types fields should exist, because TextualFromNative?() use a JSON format.

My question is about NativeFromBinary(). I'm getting type fields in the interface{} returned from it. Shouldn't these types only be added for JSON encoding? The Native is a map (or interface{}) object in go, not a JSON, right?

If an example is required, there is one in the function description.

//             {
//               "type": "record",
//               "name": "LongList",
//               "fields" : [
//                 {"name": "next", "type": ["null", "LongList"], "default": null}
//               ]
//             }
//        (...)
//         binary := []byte{0x2, 0x2, 0x0}
//
//         native, _, err := codec.NativeFromBinary(binary)
//         if err != nil {
//             fmt.Println(err)
//         }
//
//         fmt.Printf("%v", native)
//         // Output: map[next:map[LongList:map[next:map[LongList:map[next:<nil>]]]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant