Skip to content
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

Rename kube-derive attribute from description to doc #1363

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/crd_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions kube-derive/src/custom_resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct KubeAttrs {
group: String,
version: String,
kind: String,
description: Option<String>,
doc: Option<String>,
#[darling(rename = "root")]
kind_struct: Option<String>,
/// lowercase plural of kind (inferred if omitted)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions kube-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion kube-derive/tests/crd_schema_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading