Closed clux closed 3 years ago
Yes, looks like it would be fine. I searched for to nil
and is nil
to see if any fields have comments that would indicate they differentiate between empty lists/maps and nil
, and it doesn't seem like there are any.
@Arnavion this seems to be happening again since your fix in 6cff214. I'm currently trying out 0.22.0 and seeing the exact example given in this issue (ObjectMeta.labels
) being of type Option<BTreeMap<...>>
As an example;
ObjectMeta
has a bunch of common listables:https://github.com/kubernetes/apimachinery/blob/945d4ebf362b3bbbc070e89371e69f9394737676/pkg/apis/meta/v1/types.go#L226-L264
These are marked as
+optional
and also withomitempty
. This implies they do not distinguish between the empty list/map case and the missing list/map case.However, here we end up wrapping these objects in an
Option<SomeListable<..>>
:So my question is; is it possible to match serde default annotations on listables when there's a omitempty annnotation? It would be a lot more ergonomic if we saw structs with that looking like:
so we didn't have to unpack an any of these. We already have to check for presence of the item we want in the collection everywhere anyway.