-
Notifications
You must be signed in to change notification settings - Fork 99
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
Problem with empty slices vs nil. #371
Comments
There is no significant difference between a
This would be a |
No this is not a
There are in fact differences:
What you refer to is that both have a length of 0 I think. |
What is your proposal here? |
I think that it should be possible to have byte slice being supported for the union The current problem for us is that if I have the above union in the schema, I get the '[]uint8 is unsupported for Avro union' error. I think this could be supported and if the value really is nil, the null is used. If you want to change the schema generation or have that optional is not my concern as we do not use that and have our own schema generator as a proprietary tool that generates our "avrox" schemer (https://github.com/metatexx/avrox). |
This is currently supported using |
We can't use Having I am not sure how easy it is to make a PR for the special handling of slices and maps. From the error message it seems to me that it does not happen inside P.S.: I think we would like to sponsor this project, but I do not see a way for doing that. |
You would need to look at Sponsorships do not work in my country, no stripe here. |
Can you give this branch a try and see if it does what you think it should: #372 |
When using a
[]byte
in a struct and doing a marshal / unmarschal with a nil value in[]byte
it is changed to an empty slice. Should []byte (aka []uint8) not be supported for Avro union (["null", "bytes"]
), so we can keep the difference between the nil and the empty slice?The text was updated successfully, but these errors were encountered: