From 3a4f72414a4ad3733c2683514abff1924271759d Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Fri, 1 Dec 2023 12:04:57 +0100 Subject: [PATCH] Rename kube-derive attribute from description to doc (#1363) Follow-up of https://github.com/kube-rs/kube/pull/1359 Signed-off-by: Sebastian Bernauer --- examples/crd_derive.rs | 2 +- kube-derive/src/custom_resource.rs | 8 ++++---- kube-derive/src/lib.rs | 4 ++-- kube-derive/tests/crd_schema_test.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/crd_derive.rs b/examples/crd_derive.rs index c96984d16..17a742600 100644 --- a/examples/crd_derive.rs +++ b/examples/crd_derive.rs @@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize}; plural = "fooz", root = "FooCrd", namespaced, - description = "Custom resource representing a Foo", + doc = "Custom resource representing a Foo", status = "FooStatus", derive = "PartialEq", derive = "Default", diff --git a/kube-derive/src/custom_resource.rs b/kube-derive/src/custom_resource.rs index a02160b16..891369bfc 100644 --- a/kube-derive/src/custom_resource.rs +++ b/kube-derive/src/custom_resource.rs @@ -10,7 +10,7 @@ struct KubeAttrs { group: String, version: String, kind: String, - description: Option, + doc: Option, #[darling(rename = "root")] kind_struct: Option, /// lowercase plural of kind (inferred if omitted) @@ -146,7 +146,7 @@ pub(crate) fn derive(input: proc_macro2::TokenStream) -> proc_macro2::TokenStrea kind, kind_struct, version, - description, + doc, namespaced, derives, schema: schema_mode, @@ -241,8 +241,8 @@ pub(crate) fn derive(input: proc_macro2::TokenStream) -> proc_macro2::TokenStrea derive_paths.push(syn::parse_quote! { #schemars::JsonSchema }); } - let docstr = description - .unwrap_or_else(|| format!(" Auto-generated derived type for {ident} via `CustomResource`")); + let docstr = + doc.unwrap_or_else(|| format!(" Auto-generated derived type for {ident} via `CustomResource`")); let quoted_serde = Literal::string(&serde.to_token_stream().to_string()); let root_obj = quote! { #[doc = #docstr] diff --git a/kube-derive/src/lib.rs b/kube-derive/src/lib.rs index 250b3a0cf..68b068dad 100644 --- a/kube-derive/src/lib.rs +++ b/kube-derive/src/lib.rs @@ -141,7 +141,7 @@ mod custom_resource; /// ## `#[kube(category = "apps")]` /// Add a single category to `crd.spec.names.categories`. /// -/// ## `#[kube(description = "description")]` +/// ## `#[kube(doc = "description")]` /// Sets the description of the schema in the generated CRD. If not specified /// `Auto-generated derived type for {customResourceName} via CustomResource` will be used instead. /// @@ -159,7 +159,7 @@ mod custom_resource; /// kind = "Foo", /// root = "FooCrd", /// namespaced, -/// description = "Custom resource representing a Foo", +/// doc = "Custom resource representing a Foo", /// status = "FooStatus", /// derive = "PartialEq", /// singular = "foot", diff --git a/kube-derive/tests/crd_schema_test.rs b/kube-derive/tests/crd_schema_test.rs index c9cf73af3..d1c9116a7 100644 --- a/kube-derive/tests/crd_schema_test.rs +++ b/kube-derive/tests/crd_schema_test.rs @@ -15,7 +15,7 @@ use std::collections::HashMap; kind = "Foo", category = "clux", namespaced, - description = "Custom resource representing a Foo", + doc = "Custom resource representing a Foo", derive = "PartialEq", shortname = "fo", shortname = "f"