-
-
Notifications
You must be signed in to change notification settings - Fork 371
Transform optional enums to match pre kube 2.0.0 format #1853
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
base: main
Are you sure you want to change the base?
Transform optional enums to match pre kube 2.0.0 format #1853
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1853 +/- ##
=======================================
+ Coverage 74.7% 74.8% +0.1%
=======================================
Files 84 84
Lines 7938 7951 +13
=======================================
+ Hits 5927 5941 +14
+ Misses 2011 2010 -1
🚀 New features to boost your workflow:
|
7d9bcce to
f93db71
Compare
clux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks sensible to me. minor nits only.
need to look at the bigger PR though.
Signed-off-by: Danil-Grigorev <[email protected]>
f93db71 to
e4e239b
Compare
clux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot. Easy to review. Maybe let's wait for a response on #1839 first. They have tests for this exact transform, and it'd be good to preserve those / get some tests for this.
let's wait with this. the #1893 pr is more holistic approach, so lets see if we can get that merged first.
Motivation
Schemars bump to 1.0 with kube 2.0 broke optional enum CRD generation. Verified it with schemars 1.1.0 - problem still exists.
Solution
Introduce an
OptionalEnumtransform to allow usage ofOption<Enum>as inkube1.0.0 withschemars < 1.0.0.Removes incompatible output of schema generator with:
{ "anyOf": [ { "enum": ["Debug", "Info", "Error"], "type": "string" }, { "enum": [null], "nullable": true } ] }replacing it with expected:
{ "enum": ["Debug", "Info", "Error"], "type": "string", "nullable": true }Fixes: #1821