Open henderiw opened 2 years ago
Hm, crd specification wise, I feel like the schema should really generate those objects (origin
and target
) with a x-preserve-unknown-fields
specifier (see #31) so that we know that it's worth deserialising the properties into a serde_json::Value
, because otherwise, I think what we are doing is technically correct.
However, it's possible we could have a flag for making empty-struct always use Value
rather than empty structs. Need to consider this when implementing #31.
Thanks for the report, will try to dig into this when I have time.
We did a partial step in this direction in https://github.com/kube-rs/kopium/pull/230 but i believe there's probably one more step like that.
runtime.RawExtensions serves as a blob in the k8s CRD afaik and is reflected as an object in the openapi spec, like this.
The specific objects are origin and target, which are defined in go as following
when I use kopium to generate the rust code I get this.
As you can see the struct TransformInputOrigin and TransformInputTarget are empty. The issue is that when you serializer/deserializerl it in json/yaml the data behind these object is no longer accessible. When I change it to the following manually the marshal/unmarshal function works as the serde_json::Value is seen as a generic object in the serializer/deserializer afaik.
Can this be accommodated?