Use pointers for boxed primitive types #8
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes the Go API to use pointers for the places where the original Strimzi API uses boxed primitives (e.g.
IntegerorBoolean).The reason for this is that with the boxed primitives, the Strimzi API can have them at a
nullvalue and can assign it special meaning. For example an API field withBooleantype can be interpreted as true or full when set tonullvalue. But the Golang APi when usingbooldoes not let you to set it tonullvalue easily. As an example of an error it can cause when working with the Strimzi resources:enableServiceLinksdefaults totruein Kubernetesnull) in Strimzi Java API, it will be passed as unset to the Kubernetes Pods Strimzi creates as such and it will result into the service links being created in the Podboolfield will default to false. So when you for example set it to false, it would assume it has the default value and not serialize it into the resource. But that would effectively mean it is set to true.This Pr moves in these cases to use
*bool. That way it respects thenull/nilvalues. While this is harder to use, it respects the Strimzi API (and the ?mistakes? we did there).