diff --git a/crates/stackable-operator/src/crd/git_sync/mod.rs b/crates/stackable-operator/src/crd/git_sync/mod.rs index ba3c7d794..c6ce91022 100644 --- a/crates/stackable-operator/src/crd/git_sync/mod.rs +++ b/crates/stackable-operator/src/crd/git_sync/mod.rs @@ -68,7 +68,7 @@ pub mod versioned { // FIXME: The roundtrip looses data when private keys are used. // See https://github.com/stackabletech/issues/issues/849 for details. #[versioned(changed( - since = "v1alpha2", + in = "v1alpha2", previous_name = "credentials_secret", previous_type = "Option", upgrade_with = credentials_secret_to_basic_auth, diff --git a/crates/stackable-versioned-macros/src/attrs/item/mod.rs b/crates/stackable-versioned-macros/src/attrs/item/mod.rs index ccbf4500b..f33fc07e1 100644 --- a/crates/stackable-versioned-macros/src/attrs/item/mod.rs +++ b/crates/stackable-versioned-macros/src/attrs/item/mod.rs @@ -67,27 +67,27 @@ impl CommonItemAttributes { let mut errors = Error::accumulator(); if let Some(added) = &self.added - && !versions.iter().any(|v| v.inner == *added.since) + && !versions.iter().any(|v| v.inner == *added.version) { errors.push(Error::custom( "the `added` action uses a version which is not declared via `#[versioned(version)]`", - ).with_span(&added.since.span())); + ).with_span(&added.version.span())); } for change in &self.changes { - if !versions.iter().any(|v| v.inner == *change.since) { + if !versions.iter().any(|v| v.inner == *change.version) { errors.push(Error::custom( "the `changed` action uses a version which is not declared via `#[versioned(version)]`" - ).with_span(&change.since.span())); + ).with_span(&change.version.span())); } } if let Some(deprecated) = &self.deprecated - && !versions.iter().any(|v| v.inner == *deprecated.since) + && !versions.iter().any(|v| v.inner == *deprecated.version) { errors.push(Error::custom( "the `deprecated` action uses a version which is not declared via `#[versioned(version)]`", - ).with_span(&deprecated.since.span())); + ).with_span(&deprecated.version.span())); } errors.finish() @@ -108,16 +108,18 @@ impl CommonItemAttributes { /// rules from above apply here as well. fn validate_action_combinations(&self, item_idents: &impl ItemIdents) -> Result<()> { match (&self.added, &self.changes, &self.deprecated) { - (Some(added), _, Some(deprecated)) if *added.since == *deprecated.since => Err( + (Some(added), _, Some(deprecated)) if *added.version == *deprecated.version => Err( Error::custom("cannot be marked as `added` and `deprecated` in the same version") .with_span(item_idents.original()), ), - (Some(added), changed, _) if changed.iter().any(|r| *r.since == *added.since) => Err( - Error::custom("cannot be marked as `added` and `changed` in the same version") - .with_span(item_idents.original()), - ), + (Some(added), changed, _) if changed.iter().any(|r| *r.version == *added.version) => { + Err( + Error::custom("cannot be marked as `added` and `changed` in the same version") + .with_span(item_idents.original()), + ) + } (_, changed, Some(deprecated)) - if changed.iter().any(|r| *r.since == *deprecated.since) => + if changed.iter().any(|r| *r.version == *deprecated.version) => { Err(Error::custom( "cannot be marked as `deprecated` and `changed` in the same version", @@ -141,8 +143,8 @@ impl CommonItemAttributes { /// - All `changed` actions must use a greater version than `added` but a /// lesser version than `deprecated`. fn validate_action_order(&self, item_idents: &impl ItemIdents) -> Result<()> { - let added_version = self.added.as_ref().map(|a| *a.since); - let deprecated_version = self.deprecated.as_ref().map(|d| *d.since); + let added_version = self.added.as_ref().map(|a| *a.version); + let deprecated_version = self.deprecated.as_ref().map(|d| *d.version); // First, validate that the added version is less than the deprecated // version. @@ -158,8 +160,8 @@ impl CommonItemAttributes { // Now, iterate over all changes and ensure that their versions are // between the added and deprecated version. if !self.changes.iter().all(|r| { - added_version.is_none_or(|a| a < *r.since) - && deprecated_version.is_none_or(|d| d > *r.since) + added_version.is_none_or(|a| a < *r.version) + && deprecated_version.is_none_or(|d| d > *r.version) }) { return Err(Error::custom( "all changes must use versions higher than `added` and lower than `deprecated`", @@ -229,7 +231,7 @@ impl CommonItemAttributes { { errors.push(Error::custom( "`previous_name`, `previous_type` and `previous_docs` are unset. Is this `changed()` action needed?" - ).with_span(&change.since.span())); + ).with_span(&change.version.span())); } // This ensures that `previous_name` doesn't include the deprecation prefix. @@ -306,7 +308,7 @@ impl CommonItemAttributes { .iter() .filter_map(|change| { let docs = change.previous_docs.as_deref()?; - Some((*change.since, docs.into_doc_comments())) + Some((*change.version, docs.into_doc_comments())) }) .collect() } @@ -330,7 +332,7 @@ impl CommonItemAttributes { let mut actions = BTreeMap::new(); actions.insert( - *deprecated.since, + *deprecated.version, ItemStatus::Deprecation { previous_ident: ident.clone(), ident: deprecated_ident.clone(), @@ -353,7 +355,7 @@ impl CommonItemAttributes { .map_or_else(|| ty.clone(), |sv| sv.deref().clone()); actions.insert( - *change.since, + *change.version, ItemStatus::Change { downgrade_with: change.downgrade_with.as_deref().cloned(), upgrade_with: change.upgrade_with.as_deref().cloned(), @@ -372,7 +374,7 @@ impl CommonItemAttributes { // added action if there is any. if let Some(added) = self.added { actions.insert( - *added.since, + *added.version, ItemStatus::Addition { default_fn: added.default_fn.deref().clone(), ident, @@ -403,7 +405,7 @@ impl CommonItemAttributes { .map_or_else(|| ty.clone(), |sv| sv.deref().clone()); actions.insert( - *change.since, + *change.version, ItemStatus::Change { downgrade_with: change.downgrade_with.as_deref().cloned(), upgrade_with: change.upgrade_with.as_deref().cloned(), @@ -422,7 +424,7 @@ impl CommonItemAttributes { // added action if there is any. if let Some(added) = self.added { actions.insert( - *added.since, + *added.version, ItemStatus::Addition { default_fn: added.default_fn.deref().clone(), ident, @@ -437,7 +439,7 @@ impl CommonItemAttributes { let mut actions = BTreeMap::new(); actions.insert( - *added.since, + *added.version, ItemStatus::Addition { default_fn: added.default_fn.deref().clone(), ident: idents.original().clone(), @@ -456,11 +458,12 @@ impl CommonItemAttributes { /// For the added() action /// /// Example usage: -/// - `added(since = "...")` -/// - `added(since = "...", default_fn = "custom_fn")` +/// - `added(in = "...")` +/// - `added(in = "...", default_fn = "custom_fn")` #[derive(Clone, Debug, FromMeta)] pub struct AddedAttributes { - pub since: SpannedValue, + #[darling(rename = "in")] + pub version: SpannedValue, #[darling(rename = "default", default = "default_default_fn")] pub default_fn: SpannedValue, @@ -477,14 +480,15 @@ fn default_default_fn() -> SpannedValue { /// For the changed() action /// /// Example usage: -/// - `changed(since = "...", previous_name = "...")` -/// - `changed(since = "...", previous_name = "...", previous_type="...")` -/// - `changed(since = "...", previous_name = "...", previous_type="...", upgrade_with = "...")` -/// - `changed(since = "...", previous_name = "...", previous_type="...", downgrade_with = "...")` -/// - `changed(since = "...", previous_docs = "...")` +/// - `changed(in = "...", previous_name = "...")` +/// - `changed(in = "...", previous_name = "...", previous_type="...")` +/// - `changed(in = "...", previous_name = "...", previous_type="...", upgrade_with = "...")` +/// - `changed(in = "...", previous_name = "...", previous_type="...", downgrade_with = "...")` +/// - `changed(in = "...", previous_docs = "...")` #[derive(Clone, Debug, FromMeta)] pub struct ChangedAttributes { - pub since: SpannedValue, + #[darling(rename = "in")] + pub version: SpannedValue, pub previous_name: Option>, pub previous_type: Option>, pub previous_docs: Option>, @@ -495,10 +499,11 @@ pub struct ChangedAttributes { /// For the deprecated() action /// /// Example usage: -/// - `deprecated(since = "...")` -/// - `deprecated(since = "...", note = "...")` +/// - `deprecated(in = "...")` +/// - `deprecated(in = "...", note = "...")` #[derive(Clone, Debug, FromMeta)] pub struct DeprecatedAttributes { - pub since: SpannedValue, + #[darling(rename = "in")] + pub version: SpannedValue, pub note: Option>, } diff --git a/crates/stackable-versioned-macros/src/lib.rs b/crates/stackable-versioned-macros/src/lib.rs index 81e0f1654..f34dfb5e1 100644 --- a/crates/stackable-versioned-macros/src/lib.rs +++ b/crates/stackable-versioned-macros/src/lib.rs @@ -356,7 +356,7 @@ mod utils; /// ))] /// # #[derive(Clone, Debug, Deserialize, Serialize, CustomResource, JsonSchema)] /// pub struct FooSpec { -/// #[versioned(deprecated(since = "v1beta1"))] +/// #[versioned(deprecated(in = "v1beta1"))] /// deprecated_bar: usize, /// baz: bool, /// } @@ -393,7 +393,7 @@ mod utils; /// This action indicates that an item is added in a particular version. /// Available arguments are: /// -/// - `since` to indicate since which version the item is present. +/// - `in` to indicate in which version the item was added. /// - `default` to customize the default function used to populate the item /// in auto-generated conversion implementations. /// @@ -402,7 +402,7 @@ mod utils; /// #[versioned(version(name = "v1alpha1"), version(name = "v1beta1"))] /// mod versioned { /// pub struct Foo { -/// #[versioned(added(since = "v1beta1"))] +/// #[versioned(added(in = "v1beta1"))] /// bar: usize, /// baz: bool, /// } @@ -457,7 +457,7 @@ mod utils; /// #[versioned(version(name = "v1alpha1"), version(name = "v1beta1"))] /// mod versioned { /// pub struct Foo { -/// #[versioned(added(since = "v1beta1", default = "default_bar"))] +/// #[versioned(added(in = "v1beta1", default = "default_bar"))] /// bar: usize, /// baz: bool, /// } @@ -498,7 +498,7 @@ mod utils; /// You can choose to change the name, change the type, change the doc comment /// or combine multiple changes. Available arguments are: /// -/// - `since` to indicate since which version the item is changed. +/// - `in` to indicate in which version the item is changed. /// - `previous_name` to declare the previous name of the field. /// - `previous_type` to declare the previous type of the field. /// - `previous_docs` to declare the previous doc comments of the item. @@ -516,7 +516,7 @@ mod utils; /// mod versioned { /// pub struct Foo { /// #[versioned(changed( -/// since = "v1beta1", +/// in = "v1beta1", /// previous_name = "prev_bar", /// previous_type = "u16", /// downgrade_with = usize_to_u16 @@ -581,7 +581,7 @@ mod utils; /// mod versioned { /// pub struct Foo { /// /// The number of bars. -/// #[versioned(changed(since = "v1beta1", previous_docs = "The bar."))] +/// #[versioned(changed(in = "v1beta1", previous_docs = "The bar."))] /// bar: usize, /// baz: bool, /// } @@ -621,10 +621,10 @@ mod utils; /// /// ### Deprecated Action /// -/// This action indicates that an item is deprecated in a particular version. +/// This action indicates that an item was deprecated in a particular version. /// Deprecated items are not removed. Available arguments are: /// -/// - `since` to indicate since which version the item is deprecated. +/// - `in` to indicate in which version the item was deprecated. /// - `note` to specify an optional deprecation note. /// /// ``` @@ -632,7 +632,7 @@ mod utils; /// #[versioned(version(name = "v1alpha1"), version(name = "v1beta1"))] /// mod versioned { /// pub struct Foo { -/// #[versioned(deprecated(since = "v1beta1"))] +/// #[versioned(deprecated(in = "v1beta1"))] /// deprecated_bar: usize, /// baz: bool, /// } @@ -705,7 +705,7 @@ mod utils; /// #[versioned(version(name = "v1alpha1"), version(name = "v1beta1"))] /// mod versioned { /// pub struct Foo { -/// #[versioned(changed(since = "v1beta1", previous_type = "Vec"), hint(vec))] +/// #[versioned(changed(in = "v1beta1", previous_type = "Vec"), hint(vec))] /// bar: Vec, /// baz: bool, /// } @@ -747,7 +747,7 @@ mod utils; /// #[versioned(crd(group = "example.com", doc = "My custom resource."))] /// #[derive(Clone, Debug, Deserialize, Serialize, CustomResource, JsonSchema)] /// pub struct FooSpec { -/// #[versioned(added(since = "v1beta1"))] +/// #[versioned(added(in = "v1beta1"))] /// bar: usize, /// baz: bool, /// } @@ -818,10 +818,10 @@ mod utils; /// #[versioned(crd(group = "example.com", doc = "My custom resource."))] /// #[derive(Clone, Debug, Deserialize, Serialize, CustomResource, JsonSchema)] /// pub struct FooSpec { -/// #[versioned(added(since = "v1beta1"))] +/// #[versioned(added(in = "v1beta1"))] /// bar: usize, /// -/// #[versioned(added(since = "v1"))] +/// #[versioned(added(in = "v1"))] /// baz: bool, /// /// quox: String, @@ -966,7 +966,7 @@ mod utils; /// struct Baz { /// quax: String, /// -/// #[versioned(added(since = "v1beta1"))] +/// #[versioned(added(in = "v1beta1"))] /// quox: bool, /// } /// } @@ -1009,7 +1009,7 @@ mod utils; /// struct Baz { /// quax: String, /// -/// #[versioned(added(since = "v1beta1"))] +/// #[versioned(added(in = "v1beta1"))] /// quox: bool, /// } /// } diff --git a/crates/stackable-versioned-macros/tests/inputs/fail/changed.rs b/crates/stackable-versioned-macros/tests/inputs/fail/changed.rs index df9527537..8dc084cf9 100644 --- a/crates/stackable-versioned-macros/tests/inputs/fail/changed.rs +++ b/crates/stackable-versioned-macros/tests/inputs/fail/changed.rs @@ -9,9 +9,9 @@ use stackable_versioned_macros::versioned; mod versioned { struct Foo { #[versioned( - changed(since = "v1beta1", previous_name = "deprecated_bar"), - changed(since = "v1", previous_name = "deprecated_baz"), - changed(since = "v2") + changed(in = "v1beta1", previous_name = "deprecated_bar"), + changed(in = "v1", previous_name = "deprecated_baz"), + changed(in = "v2") )] bar: usize, } diff --git a/crates/stackable-versioned-macros/tests/inputs/fail/changed.stderr b/crates/stackable-versioned-macros/tests/inputs/fail/changed.stderr index a766cb4f2..8ac7629dc 100644 --- a/crates/stackable-versioned-macros/tests/inputs/fail/changed.stderr +++ b/crates/stackable-versioned-macros/tests/inputs/fail/changed.stderr @@ -1,17 +1,17 @@ error: the previous name must not start with the deprecation prefix - --> tests/inputs/fail/changed.rs:12:56 + --> tests/inputs/fail/changed.rs:12:53 | -12 | changed(since = "v1beta1", previous_name = "deprecated_bar"), - | ^^^^^^^^^^^^^^^^ +12 | changed(in = "v1beta1", previous_name = "deprecated_bar"), + | ^^^^^^^^^^^^^^^^ error: the previous name must not start with the deprecation prefix - --> tests/inputs/fail/changed.rs:13:51 + --> tests/inputs/fail/changed.rs:13:48 | -13 | changed(since = "v1", previous_name = "deprecated_baz"), - | ^^^^^^^^^^^^^^^^ +13 | changed(in = "v1", previous_name = "deprecated_baz"), + | ^^^^^^^^^^^^^^^^ error: `previous_name`, `previous_type` and `previous_docs` are unset. Is this `changed()` action needed? - --> tests/inputs/fail/changed.rs:14:29 + --> tests/inputs/fail/changed.rs:14:26 | -14 | changed(since = "v2") - | ^^^^ +14 | changed(in = "v2") + | ^^^^ diff --git a/crates/stackable-versioned-macros/tests/inputs/fail/spec_suffix.rs b/crates/stackable-versioned-macros/tests/inputs/fail/spec_suffix.rs index 33cfaf4ea..7965f3689 100644 --- a/crates/stackable-versioned-macros/tests/inputs/fail/spec_suffix.rs +++ b/crates/stackable-versioned-macros/tests/inputs/fail/spec_suffix.rs @@ -12,8 +12,8 @@ mod versioned { #[versioned(crd(group = "stackable.tech", doc = "Test"))] pub struct Foo { #[versioned( - added(since = "v1beta1"), - changed(since = "v1", previous_name = "bah", previous_type = "u16") + added(in = "v1beta1"), + changed(in = "v1", previous_name = "bah", previous_type = "u16") )] bar: usize, baz: bool, diff --git a/crates/stackable-versioned-macros/tests/inputs/fail/unknown_version.rs b/crates/stackable-versioned-macros/tests/inputs/fail/unknown_version.rs index 5847817c6..6e1ca1b52 100644 --- a/crates/stackable-versioned-macros/tests/inputs/fail/unknown_version.rs +++ b/crates/stackable-versioned-macros/tests/inputs/fail/unknown_version.rs @@ -3,7 +3,7 @@ use stackable_versioned_macros::versioned; #[versioned(version(name = "v1alpha1"))] mod versioned { struct Foo { - #[versioned(added(since = "v1alpha2"))] + #[versioned(added(in = "v1alpha2"))] bar: usize, } } diff --git a/crates/stackable-versioned-macros/tests/inputs/fail/unknown_version.stderr b/crates/stackable-versioned-macros/tests/inputs/fail/unknown_version.stderr index 070bd3e2a..f63b5bf32 100644 --- a/crates/stackable-versioned-macros/tests/inputs/fail/unknown_version.stderr +++ b/crates/stackable-versioned-macros/tests/inputs/fail/unknown_version.stderr @@ -1,5 +1,5 @@ error: the `added` action uses a version which is not declared via `#[versioned(version)]` - --> tests/inputs/fail/unknown_version.rs:6:35 + --> tests/inputs/fail/unknown_version.rs:6:32 | -6 | #[versioned(added(since = "v1alpha2"))] - | ^^^^^^^^^^ +6 | #[versioned(added(in = "v1alpha2"))] + | ^^^^^^^^^^ diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/added.rs b/crates/stackable-versioned-macros/tests/inputs/pass/added.rs index 33b2af588..e1fdd9e43 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/added.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/added.rs @@ -11,10 +11,10 @@ mod versioned { struct Foo { username: String, - #[versioned(added(since = "v1alpha2", default = default_first_name))] + #[versioned(added(in = "v1alpha2", default = default_first_name))] first_name: String, - #[versioned(added(since = "v1beta1"))] + #[versioned(added(in = "v1beta1"))] last_name: String, } } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/basic.rs b/crates/stackable-versioned-macros/tests/inputs/pass/basic.rs index 5a6f0f1d0..38b069afb 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/basic.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/basic.rs @@ -25,8 +25,8 @@ pub(crate) mod versioned { )] struct FooSpec { #[versioned( - added(since = "v1beta1"), - changed(since = "v1", previous_name = "bah", previous_type = "u16", downgrade_with = usize_to_u16) + added(in = "v1beta1"), + changed(in = "v1", previous_name = "bah", previous_type = "u16", downgrade_with = usize_to_u16) )] bar: usize, baz: bool, diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking.rs b/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking.rs index f7cc4004e..7c820e230 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking.rs @@ -18,7 +18,7 @@ pub(crate) mod versioned { ))] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, CustomResource)] pub(crate) struct FooSpec { - #[versioned(added(since = "v1beta1"), changed(since = "v1", previous_name = "bah"))] + #[versioned(added(in = "v1beta1"), changed(in = "v1", previous_name = "bah"))] bar: usize, baz: bool, } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_enum.rs b/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_enum.rs index 428ee98d4..2deb5fd7d 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_enum.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_enum.rs @@ -27,7 +27,9 @@ pub(crate) mod versioned { // Nested variants with named fields are supported as well. #[versioned(nested)] - Hive { connector: IcebergConnector }, + Hive { + connector: IcebergConnector, + }, // Nested tuple variants with multiple fields use the index as an additional path segment. #[versioned(nested)] @@ -45,7 +47,7 @@ pub(crate) mod versioned { pub(crate) struct IcebergConnector { metastore: Option, - #[versioned(added(since = "v1alpha2"))] + #[versioned(added(in = "v1alpha2"))] rest_catalog_uri: Option, } } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_generics.rs b/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_generics.rs index 2e474e978..73aa07a26 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_generics.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_generics.rs @@ -18,7 +18,7 @@ pub(crate) mod versioned { ))] #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, CustomResource)] pub(crate) struct FooSpec { - #[versioned(added(since = "v1beta1"), changed(since = "v1", previous_name = "bah"))] + #[versioned(added(in = "v1beta1"), changed(in = "v1", previous_name = "bah"))] bar: usize, #[versioned(nested)] @@ -38,13 +38,13 @@ pub(crate) mod versioned { // FIXME (@Techassi): This currently leads to errors, because the generic type S is emitted // for v1alpha1 as well. There it is unused. We need to somehow figure out if a generic type // is used and if so, emit it. Otherwise, don't emit it. - // #[versioned(added(since = "v1beta1"))] + // #[versioned(added(in = "v1beta1"))] inner_2: S, // Concrete type on purpose, see the FIXME above. Added in v1 (not v1beta1) so it doesn't // share the v1beta1 upgrade bucket with FooSpec::bar. // FIXME: This is a known BUG and will be fixed in the future. - #[versioned(added(since = "v1"))] + #[versioned(added(in = "v1"))] inner_3: String, } } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_hints.rs b/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_hints.rs index 77d903fc0..2746e088e 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_hints.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/conversion_tracking_hints.rs @@ -20,7 +20,7 @@ mod versioned { struct Bar { bar_bar: String, - #[versioned(added(since = "v1alpha2"))] + #[versioned(added(in = "v1alpha2"))] baz_baz: u8, } } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/crate_overrides.rs b/crates/stackable-versioned-macros/tests/inputs/pass/crate_overrides.rs index 2c57fa7de..13fd29411 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/crate_overrides.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/crate_overrides.rs @@ -21,7 +21,7 @@ pub mod versioned { kube::CustomResource, )] pub struct FooSpec { - #[versioned(added(since = "v1beta1"), changed(since = "v1", previous_name = "bah"))] + #[versioned(added(in = "v1beta1"), changed(in = "v1", previous_name = "bah"))] bar: usize, baz: bool, } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/crate_overrides_only_kube.rs b/crates/stackable-versioned-macros/tests/inputs/pass/crate_overrides_only_kube.rs index f2c65607a..7c517770e 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/crate_overrides_only_kube.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/crate_overrides_only_kube.rs @@ -21,7 +21,7 @@ pub mod versioned { kube::CustomResource, )] pub struct FooSpec { - #[versioned(added(since = "v1beta1"), changed(since = "v1", previous_name = "bah"))] + #[versioned(added(in = "v1beta1"), changed(in = "v1", previous_name = "bah"))] bar: usize, baz: bool, } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/docs.rs b/crates/stackable-versioned-macros/tests/inputs/pass/docs.rs index 2a02bc331..f428d1b58 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/docs.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/docs.rs @@ -24,23 +24,23 @@ mod versioned { foo: String, /// Keep the main field docs the same, even after the field is deprecated. - #[versioned(deprecated(since = "v1beta1", note = "gone"))] + #[versioned(deprecated(in = "v1beta1", note = "gone"))] deprecated_bar: String, /// This is for baz - #[versioned(added(since = "v1beta1"))] + #[versioned(added(in = "v1beta1"))] baz: String, /// This is will keep changing over time. - #[versioned(changed(since = "v1beta1", previous_name = "qoox"))] - #[versioned(changed(since = "v1", previous_name = "qaax"))] + #[versioned(changed(in = "v1beta1", previous_name = "qoox"))] + #[versioned(changed(in = "v1", previous_name = "qaax"))] quux: String, /// The docs of this field changed in v1beta1 and v2. #[versioned( - changed(since = "v1beta1", previous_docs = "These are the docs in v1alpha1."), + changed(in = "v1beta1", previous_docs = "These are the docs in v1alpha1."), changed( - since = "v2", + in = "v2", previous_docs = r#" These are the docs from v1beta1 until v1. @@ -55,8 +55,8 @@ mod versioned { /// The docs of this field changed in v1, while it was renamed in v1beta1. #[versioned( - changed(since = "v1beta1", previous_name = "waldo"), - changed(since = "v1", previous_docs = "These are the docs before v1.") + changed(in = "v1beta1", previous_name = "waldo"), + changed(in = "v1", previous_docs = "These are the docs before v1.") )] fred: String, } @@ -65,7 +65,7 @@ mod versioned { #[derive(Default)] enum Bar { /// The docs of this variant changed in v1. - #[versioned(changed(since = "v1", previous_docs = "These are the docs before v1."))] + #[versioned(changed(in = "v1", previous_docs = "These are the docs before v1."))] #[default] Baz, } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/downgrade_with.rs b/crates/stackable-versioned-macros/tests/inputs/pass/downgrade_with.rs index 68e91cf83..5e33bf269 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/downgrade_with.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/downgrade_with.rs @@ -8,8 +8,8 @@ mod versioned { // This tests two additional things: // - that both unquoted and quoted usage works // - that the renamed name does get picked up correctly by the conversion function - changed(since = "v1", previous_type = "u16", previous_name = "bar", downgrade_with = u32_to_u16), - changed(since = "v2", previous_type = "u32", downgrade_with = "u64_to_u32") + changed(in = "v1", previous_type = "u16", previous_name = "bar", downgrade_with = u32_to_u16), + changed(in = "v2", previous_type = "u32", downgrade_with = "u64_to_u32") )] baz: u64, } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/enum_fields.rs b/crates/stackable-versioned-macros/tests/inputs/pass/enum_fields.rs index 87746533d..ef584f51e 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/enum_fields.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/enum_fields.rs @@ -4,7 +4,7 @@ use stackable_versioned::versioned; // --- pub mod versioned { enum Foo { - #[versioned(changed(since = "v1alpha2", previous_name = "PrevA"))] + #[versioned(changed(in = "v1alpha2", previous_name = "PrevA"))] A { aa: usize, aaa: u64, @@ -15,7 +15,7 @@ pub mod versioned { } enum Bar { - #[versioned(changed(since = "v1alpha2", previous_name = "PrevA"))] + #[versioned(changed(in = "v1alpha2", previous_name = "PrevA"))] A(A), B {}, } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/hint_map.rs b/crates/stackable-versioned-macros/tests/inputs/pass/hint_map.rs index 054abb029..cc37ff608 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/hint_map.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/hint_map.rs @@ -7,7 +7,7 @@ use stackable_versioned::versioned; pub(crate) mod versioned { pub(crate) struct Foo { #[versioned( - changed(since = "v1alpha2", previous_type = "HashMap"), + changed(in = "v1alpha2", previous_type = "HashMap"), hint(map) )] bar: HashMap, diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/module.rs b/crates/stackable-versioned-macros/tests/inputs/pass/module.rs index dc4d15d85..cea075358 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/module.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/module.rs @@ -25,10 +25,10 @@ pub(crate) mod versioned { pub struct FooSpec { bar: usize, - #[versioned(added(since = "v1"))] + #[versioned(added(in = "v1"))] baz: bool, - #[versioned(deprecated(since = "v2alpha1"))] + #[versioned(deprecated(in = "v2alpha1"))] deprecated_foo: String, } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/module_preserve.rs b/crates/stackable-versioned-macros/tests/inputs/pass/module_preserve.rs index cbef0f19e..bbd093314 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/module_preserve.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/module_preserve.rs @@ -26,10 +26,10 @@ pub(crate) mod versioned { pub struct FooSpec { bar: usize, - #[versioned(added(since = "v1"))] + #[versioned(added(in = "v1"))] baz: bool, - #[versioned(deprecated(since = "v2alpha1"))] + #[versioned(deprecated(in = "v2alpha1"))] deprecated_foo: String, } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/renamed_field.rs b/crates/stackable-versioned-macros/tests/inputs/pass/renamed_field.rs index 8ad49c053..68f319552 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/renamed_field.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/renamed_field.rs @@ -8,7 +8,7 @@ use stackable_versioned::versioned; // --- mod versioned { struct Foo { - #[versioned(changed(since = "v1beta1", previous_name = "bat"))] + #[versioned(changed(in = "v1beta1", previous_name = "bat"))] bar: usize, baz: bool, } diff --git a/crates/stackable-versioned-macros/tests/inputs/pass/renamed_kind.rs b/crates/stackable-versioned-macros/tests/inputs/pass/renamed_kind.rs index d63bbdabe..050810a5a 100644 --- a/crates/stackable-versioned-macros/tests/inputs/pass/renamed_kind.rs +++ b/crates/stackable-versioned-macros/tests/inputs/pass/renamed_kind.rs @@ -17,7 +17,7 @@ pub mod versioned { kube::CustomResource, )] pub struct FooSpec { - #[versioned(added(since = "v1beta1"), changed(since = "v1", previous_name = "bah"))] + #[versioned(added(in = "v1beta1"), changed(in = "v1", previous_name = "bah"))] bar: usize, baz: bool, } diff --git a/crates/stackable-versioned/CHANGELOG.md b/crates/stackable-versioned/CHANGELOG.md index 243db790a..21892ae2a 100644 --- a/crates/stackable-versioned/CHANGELOG.md +++ b/crates/stackable-versioned/CHANGELOG.md @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. ### Changed +- BREAKING: Rename the `since` argument of all three actions (added, changed, and deprecated) to `in` ([#1311]). - BREAKING: Rename all `from_` arguments to `previous_` ([#1313]). - BREAKING: `stackable_versioned::ChangedValue`'s `value` field type is now `serde_json::Value` instead of `yaml_serde::Value` ([#1307]). @@ -29,6 +30,7 @@ All notable changes to this project will be documented in this file. [#1306]: https://github.com/stackabletech/operator-rs/pull/1306 [#1307]: https://github.com/stackabletech/operator-rs/pull/1307 [#1309]: https://github.com/stackabletech/operator-rs/pull/1309 +[#1311]: https://github.com/stackabletech/operator-rs/pull/1311 [#1312]: https://github.com/stackabletech/operator-rs/pull/1312 [#1313]: https://github.com/stackabletech/operator-rs/pull/1313 diff --git a/crates/stackable-versioned/tests/person.rs b/crates/stackable-versioned/tests/person.rs index 949a5e05c..199506728 100644 --- a/crates/stackable-versioned/tests/person.rs +++ b/crates/stackable-versioned/tests/person.rs @@ -62,23 +62,23 @@ pub mod versioned { username: String, // In v1alpha2 first and last name have been added - #[versioned(added(since = "v1alpha2"))] + #[versioned(added(in = "v1alpha2"))] first_name: String, - #[versioned(added(since = "v1alpha2"))] + #[versioned(added(in = "v1alpha2"))] last_name: String, // We started out with a enum. As we *need* to provide a default, we have a Unknown variant. // Afterwards we figured let's be more flexible and accept any arbitrary String. // FIXME: The roundtrips are currently broken, see the `roundtrip_test_data` below. - #[versioned(added(since = "v2"), changed(since = "v3", previous_type = "Gender"))] + #[versioned(added(in = "v2"), changed(in = "v3", previous_type = "Gender"))] gender: String, // TODO (@Techassi): Dealing with Default here is kinda meh UX wise. What would really help // is enabling per-container versioning and maybe the ability to place impl blocks in here // for automatic implementations for all versions of a container. - #[versioned(added(since = "v1alpha2", default = default_relationship), nested)] + #[versioned(added(in = "v1alpha2", default = default_relationship), nested)] relationship: Relationship, #[versioned(nested)] @@ -102,7 +102,7 @@ pub mod versioned { pub struct Married { with: String, - #[versioned(added(since = "v2"))] + #[versioned(added(in = "v2"))] since: String, } @@ -110,7 +110,7 @@ pub mod versioned { pub struct Socials { email: String, - #[versioned(added(since = "v1beta1"))] + #[versioned(added(in = "v1beta1"))] mastodon: String, } }