feat: pointer values allow null values when omitempty in json tag#1862
feat: pointer values allow null values when omitempty in json tag#1862matthiasbruns wants to merge 11 commits into
Conversation
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
1961771 to
9b283e9
Compare
jakobmoellerdev
left a comment
There was a problem hiding this comment.
In general this is okay as impl, but im a bit afraid of the impact. wouldn't this mean that nullable needs to manually applied everywhere? TBH this is a very difficult thing for me because it would mean that pretty much most schemas would need to accept null. While functionally correct, Im afraid of implications on the schemas and the generators.
Wouldn't another choice be that we have the value return of null be equivalent to an empty value? As in, if a null value is discovered, that it gets inferred to be the zero value? for example, a field that is a []string, and gets set to null from an expression, could be [] as a value?
Happy to hear your thoughts
type test struct {
//+optional
MyVal int `json:myVal`
}{
"myVal":null
}could result in If there is no WDYT @jakobmoellerdev |
|
I think optional is not a good choice because it is the equivalent of |
ok let me focus on the nullable pointer implementation first (without nullable) |
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
…uns/open-component-model into feat/883_nullable_json_scheme Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
a3bd9fb to
299394d
Compare
|
now all pointers support |
|
I added the reason:
|
365b445 to
e735f18
Compare
e735f18 to
317fc8e
Compare
|
I think you missed the mark here. I was saying that omitempty is the equivalent of having no value and is also equivalent to From above my suggestion was
This is still not happening and you rely on adjusting the schema instead. |
|
We will postpone this, this needs more discussions - related PR kubernetes-sigs/kro#1003 |
On-behalf-of: SAP matthias.bruns@sap.com
What this PR does / why we need it
This PR adds nullable support to pointer types in our schema generator.This PR allows null values by checking for
omitemptyfor pointer types during schema generation.Which issue(s) this PR fixes
Contributes: #1832
Testing
Tested and used in #1846