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

gen: Avoid pointer to slices for nullable unions. #461

Open
0xjac opened this issue Sep 27, 2024 · 2 comments
Open

gen: Avoid pointer to slices for nullable unions. #461

0xjac opened this issue Sep 27, 2024 · 2 comments

Comments

@0xjac
Copy link

0xjac commented Sep 27, 2024

Related to #371 and #372, when generating a struct with a field of type ["null", "array<string>"] it would be great if there was an option to have the resulting go type be []string instead of *[]string since Go slices can be nil directly.

@0xjac
Copy link
Author

0xjac commented Oct 7, 2024

@nrwiersma If you are interested, I'm happy to submit a PR with this (with tests), including hiding the new behavior behind a feature flag (like -plain-slices) to preserve the existing behavior by default.

@nrwiersma
Copy link
Member

Sure, that would be great. I have unfortunately not had time to look at these at the moment.

0xjac added a commit to 0xjac/avro that referenced this issue Oct 7, 2024
Go maps and slices can be nil. An avro nullable union can thus be
represented directly by a map or a slice without using an explicit
pointer (`*`).

This feature is hidden being the `PlainMap` and `PlainSlice` options to
preserve the existing behavior.

Closes hamba#461
0xjac added a commit to 0xjac/avro that referenced this issue Oct 8, 2024
Go maps and slices can be nil. An avro nullable union can thus be
represented directly by a map or a slice without using an explicit
pointer (`*`).

This feature is hidden being the `PlainMap` and `PlainSlice` options to
preserve the existing behavior.

Closes hamba#461
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants