kube-rs / kopium

Kubernetes OPenapI UnMangler
Apache License 2.0
113 stars 21 forks source link

Make untyped fields use serde_json::Value directly #230

Closed Danil-Grigorev closed 6 months ago

Danil-Grigorev commented 6 months ago

Fixes #229

This fixes fields which explicitly or implicitly specify +kubebuilder:validation:Schemaless annotation. HashMap or BTreeMap is not always expected in such case, this can be anything, thus serde_json::Value.

clux commented 6 months ago

I think this makes sense. Looking back at historical discussions it doesn't look like we had a strong argument for why we packed it inside a map in https://github.com/kube-rs/kopium/issues/31

I am confused why this passes unit tests without changes to unit tests though.. There should be at least one here that causes this to fail? https://github.com/kube-rs/kopium/blob/main/src/analyzer.rs#L611-L649

Danil-Grigorev commented 6 months ago

I think the test passes correctly, because all of the fields defined there have a type: object. The field we having problem with has no type: defined at all. I’ll add a test case for this