Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make untyped fields use serde_json::Value directly #230

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

Danil-Grigorev
Copy link
Member

@Danil-Grigorev Danil-Grigorev commented Apr 24, 2024

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.

@Danil-Grigorev Danil-Grigorev changed the title [WIP] Make untyped fields use serde_json::Value directly Make untyped fields use serde_json::Value directly Apr 25, 2024
@clux
Copy link
Member

clux commented Apr 25, 2024

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 #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
Copy link
Member Author

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

@Danil-Grigorev Danil-Grigorev force-pushed the apiextensions-json-fix branch from d1d35a0 to f16b786 Compare April 25, 2024 11:06
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the test. LGTM!

@clux clux merged commit 8dac8bc into kube-rs:main Apr 25, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated serde model of apiextensionsv1.JSON does not support empty string value
2 participants