From cb1a70a90ce2208665bc4660c3c242c5ad73347b Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Mon, 18 Aug 2025 11:34:19 +0200 Subject: [PATCH 1/3] fix: Use configurable versioned crate instead of hardcoding it --- .../src/codegen/container/struct/conversion.rs | 10 +++++++--- .../src/codegen/item/field.rs | 12 +++++++++--- crates/stackable-webhook/CHANGELOG.md | 4 ++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/crates/stackable-versioned-macros/src/codegen/container/struct/conversion.rs b/crates/stackable-versioned-macros/src/codegen/container/struct/conversion.rs index e456e728e..1ca5c3d23 100644 --- a/crates/stackable-versioned-macros/src/codegen/container/struct/conversion.rs +++ b/crates/stackable-versioned-macros/src/codegen/container/struct/conversion.rs @@ -171,7 +171,7 @@ impl Struct { // names. let inserts = self.generate_tracking_inserts(direction, next_version, mod_gen_ctx); let removals = self.generate_tracking_removals(direction, next_version, mod_gen_ctx); - let json_paths = self.generate_json_paths(next_version); + let json_paths = self.generate_json_paths(next_version, mod_gen_ctx); // TODO (@Techassi): Re-add support for generics // TODO (@Techassi): We know the status, so we can hard-code it, but hard to track across structs @@ -288,11 +288,15 @@ impl Struct { } } - fn generate_json_paths(&self, next_version: &VersionDefinition) -> Option { + fn generate_json_paths( + &self, + next_version: &VersionDefinition, + mod_gen_ctx: ModuleGenerationContext<'_>, + ) -> Option { let json_paths = self .fields .iter() - .filter_map(|f| f.generate_for_json_path(next_version)) + .filter_map(|f| f.generate_for_json_path(next_version, mod_gen_ctx)) .collect(); Some(json_paths) diff --git a/crates/stackable-versioned-macros/src/codegen/item/field.rs b/crates/stackable-versioned-macros/src/codegen/item/field.rs index 52feefa82..17f717a44 100644 --- a/crates/stackable-versioned-macros/src/codegen/item/field.rs +++ b/crates/stackable-versioned-macros/src/codegen/item/field.rs @@ -358,7 +358,13 @@ impl VersionedField { } } - pub fn generate_for_json_path(&self, next_version: &VersionDefinition) -> Option { + pub fn generate_for_json_path( + &self, + next_version: &VersionDefinition, + mod_gen_ctx: ModuleGenerationContext<'_>, + ) -> Option { + let versioned_path = &*mod_gen_ctx.crates.versioned; + match (&self.changes, self.nested) { // If there are no changes and the field also not marked as nested, there is no need to // generate a path variable for that field as no tracked values need to be applied/inserted @@ -373,7 +379,7 @@ impl VersionedField { let field_ident = format_ident!("__sv_{}_path", &self.ident.as_ident()); let child_string = &self.ident.to_string(); Some(quote! { - let #field_ident = ::stackable_versioned::jthong_path(parent, #child_string); + let #field_ident = #versioned_path::jthong_path(parent, #child_string); }) } (Some(changes), _) => { @@ -385,7 +391,7 @@ impl VersionedField { let child_string = ident.to_string(); Some(quote! { - let #field_ident = ::stackable_versioned::jthong_path(parent, #child_string); + let #field_ident = #versioned_path::jthong_path(parent, #child_string); }) } _ => None, diff --git a/crates/stackable-webhook/CHANGELOG.md b/crates/stackable-webhook/CHANGELOG.md index 1cd10e2d9..e763eeaa2 100644 --- a/crates/stackable-webhook/CHANGELOG.md +++ b/crates/stackable-webhook/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Fixed + +- Replace the hardcoded `::stackable_versioned` path in the `tracking_from` function with the configurable crate override ([#XXX]). + ## [0.4.0] - 2025-07-10 ### Fixed From 4f6fa868f3871e55a0ead54c3bb7b9413cc5b934 Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Mon, 18 Aug 2025 11:36:06 +0200 Subject: [PATCH 2/3] changelog --- crates/stackable-webhook/CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/stackable-webhook/CHANGELOG.md b/crates/stackable-webhook/CHANGELOG.md index e763eeaa2..dfa6f8b3b 100644 --- a/crates/stackable-webhook/CHANGELOG.md +++ b/crates/stackable-webhook/CHANGELOG.md @@ -6,7 +6,9 @@ All notable changes to this project will be documented in this file. ### Fixed -- Replace the hardcoded `::stackable_versioned` path in the `tracking_from` function with the configurable crate override ([#XXX]). +- Replace the hardcoded `::stackable_versioned` path in the `tracking_from` function with the configurable crate override ([#1079]). + +[#1079]: https://github.com/stackabletech/operator-rs/pull/1079 ## [0.4.0] - 2025-07-10 From 2c761a259ee7a01cdc29e65dd95eb1a0a8a47e9c Mon Sep 17 00:00:00 2001 From: Sebastian Bernauer Date: Mon, 18 Aug 2025 11:58:37 +0200 Subject: [PATCH 3/3] Put changelog entry in correct file --- crates/stackable-versioned/CHANGELOG.md | 6 ++++++ crates/stackable-webhook/CHANGELOG.md | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/stackable-versioned/CHANGELOG.md b/crates/stackable-versioned/CHANGELOG.md index 88f785d94..596e296f8 100644 --- a/crates/stackable-versioned/CHANGELOG.md +++ b/crates/stackable-versioned/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Fixed + +- Replace the hardcoded `::stackable_versioned` path in the `tracking_from` function with the configurable crate override ([#1079]). + +[#1079]: https://github.com/stackabletech/operator-rs/pull/1079 + ## [0.8.0] - 2025-07-10 ### Added diff --git a/crates/stackable-webhook/CHANGELOG.md b/crates/stackable-webhook/CHANGELOG.md index dfa6f8b3b..1cd10e2d9 100644 --- a/crates/stackable-webhook/CHANGELOG.md +++ b/crates/stackable-webhook/CHANGELOG.md @@ -4,12 +4,6 @@ All notable changes to this project will be documented in this file. ## [Unreleased] -### Fixed - -- Replace the hardcoded `::stackable_versioned` path in the `tracking_from` function with the configurable crate override ([#1079]). - -[#1079]: https://github.com/stackabletech/operator-rs/pull/1079 - ## [0.4.0] - 2025-07-10 ### Fixed