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-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