fix: Generate valid CRDs for fields with Optional enums and doc-comments#1907
fix: Generate valid CRDs for fields with Optional enums and doc-comments#1907NickLarsenNZ wants to merge 6 commits intokube-rs:mainfrom
Conversation
|
Thanks for working on this! I think the module restructuring could be split into a separate PR. It would be easier to review if this PR focuses only on fixing #1906, and the refactoring comes as a follow-up. What do you think? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1907 +/- ##
=======================================
+ Coverage 76.1% 76.2% +0.1%
=======================================
Files 86 87 +1
Lines 8399 8429 +30
=======================================
+ Hits 6387 6418 +31
+ Misses 2012 2011 -1
🚀 New features to boost your workflow:
|
|
I've submitted #1908 with a minimal fix. Your PR introduces 248 new lines with module restructuring and Just removing that check (1 line) is enough since the remaining conditions already ensure we only match
The module restructuring could be a good follow-up, but I'd prefer to keep the bug fix minimal. |
… CRD to be produced Signed-off-by: Nick Larsen <nick.larsen@stackable.tech>
Schema tests included Signed-off-by: Nick Larsen <nick.larsen@stackable.tech>
… now preserved Signed-off-by: Nick Larsen <nick.larsen@stackable.tech>
Note: Cause by inline_attribute_width Signed-off-by: Nick Larsen <nick.larsen@stackable.tech>
Signed-off-by: Nick Larsen <nick.larsen@stackable.tech>
Note: This should be done on other transformers in a future PR to keep this PR related to what it is fixing. Signed-off-by: Nick Larsen <nick.larsen@stackable.tech>
80c342f to
6c533bb
Compare
clux
left a comment
There was a problem hiding this comment.
quick first pass. i think this is a much better size of PR. thank you for your patience.
appreciate you're not moving to too much code around
hopes that the other transformers and their tests will be moved into individual modules [..] but decided to wait
yeah, let's wait until after this PR for that please.
| if any_of.len() != 2 { | ||
| return; | ||
| } |
There was a problem hiding this comment.
if possible. when checking for length, you should ideally destructure like in the original impl
let [first, second] = arr.as_slice() else {
return;
};
to avoid a naked [0] and [1] later (which is only safe if you look 10 lines up)
but i don't know if this makes sense with the impl below (follow-up comment)
| return; | ||
| } | ||
|
|
||
| let entry_is_null: [bool; 2] = any_of |
There was a problem hiding this comment.
this map needs a comment for what it's doing
| /// } | ||
| /// ``` | ||
| /// | ||
| /// This transform implementation prevents this specific case from happening. |
There was a problem hiding this comment.
this comment is a moved variant of the old implementation, but it's only talking about the old "specific case" even though the implementation has been completely changed. is this right?
Fixes #1906
Motivation
This is a continuation of #1821
Solution
Replace the OptionalEnum schema transformer with the one from #1839, and adds coverage to the existing test.
In addition, I moved the
schemamodule into a subdirectory with hopes that the other transformers and their tests will be moved into individual modules below that. I am happy to do that in this PR, but decided to wait until you had a chance to look at it.