Are untagged enums supported in derived Custom Resource Definitions? #1366
Unanswered
nickwatson-ms
asked this question in
Q&A
Replies: 1 comment 1 reply
-
From what I remember, it should work.. as long as the overlapping fields match exactly. So this would work: // no overlap
enum MyEnum {
Foo {
foo: u8,
},
Bar {
bar: u8,
}
} or this: // baz exists across both variants but has the same schema (type/docs)
enum MyEnum {
Foo {
foo: u8,
/// controls bazzing factor
baz: u8,
},
Bar {
bar: u8,
/// controls bazzing factor
baz: u8,
}
} but not this: // baz has different types between the variants
enum MyEnum {
Foo {
foo: u8,
baz: u8,
},
Bar {
bar: u8,
baz: String,
}
} or even this: // baz has different docs between the two variants
enum MyEnum {
Foo {
foo: u8,
/// controls bazzing factor
baz: u8,
},
Bar {
bar: u8,
/// controls bazzing factor (via bar)
baz: u8,
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the docs for CustomResourceDefinition macro in kube-derive it reads:
"Only externally tagged enums are supported"
And the commit that documented this was merged on January 15th 2022: https://github.com/kube-rs/kube/pull/779/files#diff-21090f55af38b9e34e767a0a3e4cee3a752364d6f541a1a7be7269e85601a3b2
However I've found a completed pull request from September 26th 2022, which adds support for untagged enums in Custom Resource Defintions: #1028
Is this an issue with the docs?
Beta Was this translation helpful? Give feedback.
All reactions