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

Fix invalid CRD when Enum variants have descriptions #852

Merged
merged 7 commits into from
Mar 18, 2022

Conversation

sbernauer
Copy link
Contributor

Motivation

I would like to document the different enum variants of my CRDs with Rust doc. By doing so a description attribute should be added to the CRD enum variants. Currently placing an description on an enum variant produces an invalid CRD.

Solution

This PR fixes the problem by moving the description attribute to the correct location inside the CRD schema.
Details can be found in the code comments.

Signed-off-by: Sebastian Bernauer sebastian.bernauer@stackable.de

Signed-off-by: Sebastian Bernauer <sebastian.bernauer@stackable.de>
kube-core/src/schema.rs Outdated Show resolved Hide resolved
kube-core/src/schema.rs Show resolved Hide resolved
kube-core/src/schema.rs Show resolved Hide resolved
kube-core/src/schema.rs Outdated Show resolved Hide resolved
kube-core/src/schema.rs Outdated Show resolved Hide resolved
@sbernauer
Copy link
Contributor Author

Many thanks for your review @teozkr!
I should have implemented all your feedback with only one small exception: I decided for now to not panic if the number of properties is not equal to 1. This matches the previous behavior of if variant_obj.properties.len() == 1
Is this ok four you?

Signed-off-by: Sebastian Bernauer <sebastian.bernauer@stackable.de>
Signed-off-by: Sebastian Bernauer <sebastian.bernauer@stackable.de>
Signed-off-by: Sebastian Bernauer <sebastian.bernauer@stackable.de>
Signed-off-by: Sebastian Bernauer <sebastian.bernauer@stackable.de>
kube-core/src/schema.rs Outdated Show resolved Hide resolved
Signed-off-by: Sebastian Bernauer <sebastian.bernauer@stackable.de>
@codecov-commenter
Copy link

Codecov Report

Merging #852 (98fc31a) into master (931cd48) will increase coverage by 0.05%.
The diff coverage is 90.90%.

@@            Coverage Diff             @@
##           master     #852      +/-   ##
==========================================
+ Coverage   70.22%   70.27%   +0.05%     
==========================================
  Files          59       59              
  Lines        4215     4226      +11     
==========================================
+ Hits         2960     2970      +10     
- Misses       1255     1256       +1     
Impacted Files Coverage Δ
kube-derive/tests/crd_schema_test.rs 100.00% <ø> (ø)
kube-core/src/schema.rs 88.57% <90.90%> (+1.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 931cd48...98fc31a. Read the comment docs.

Signed-off-by: Sebastian Bernauer <sebastian.bernauer@stackable.de>
@nightkr nightkr merged commit a9d9975 into kube-rs:master Mar 18, 2022
@nightkr nightkr deleted the fix/enum-descriptions branch March 18, 2022 11:48
@clux clux added this to the 0.70.0 milestone Mar 18, 2022
@clux clux added the changelog-fix changelog fix category for prs label Mar 18, 2022
bors bot pushed a commit to stackabletech/operator-rs that referenced this pull request Mar 21, 2022
## Description

Bump kube to 0.70.0 for bugfix kube-rs/kube#852.
As this is a braking change I've updated to a new minor version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-fix changelog fix category for prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants