Replies: 1 comment 3 replies
-
Oh, that's a strange error. The documentation is actually preserved on the struct as can be seen at the beginning of Tried it on the /// Comment before FooSpec
#[kube(group = "clux.dev", version = "v1", kind = "Foo", namespaced)]
#[kube(status = "FooStatus")]
#[kube(scale = r#"{"specReplicasPath":".spec.replicas", "statusReplicasPath":".status.replicas"}"#)]
pub struct FooSpec {
name: String,
info: Option<String>,
replicas: isize,
}
/// Auto-generated derived type for FooSpec via `CustomResource`
#[serde(rename_all = "camelCase")]
pub struct Foo {
#[schemars(skip)]
pub metadata: ::k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta,
pub spec: FooSpec,
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<FooStatus>,
}
...
/// Comment before FooStatus
pub struct FooStatus {
is_bad: bool,
replicas: isize,
} but yeah, rustc definitely complains, have found one the reasons; the impl Foo {
pub fn new(name: &str, spec: FooSpec) -> Self {
Self {
metadata: ::k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta {
name: Some(name.to_string()),
..Default::default()
},
spec: spec,
status: None,
}
}
} and we can fix that in kube-derive, but not sure about where the others come from yet. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to document types generated with
kube::CustomResource
?For example:
If it's not possible today, are there any thoughts on how to best solve this problem?
Beta Was this translation helpful? Give feedback.
All reactions