From 9c54e4f4183597c1e24ce7bbaaf8d44d1fcba9fd Mon Sep 17 00:00:00 2001 From: Maxi Wittich Date: Fri, 13 Nov 2026 09:55:11 +0100 Subject: [PATCH 1/5] add trait IntoValidated for validating configs --- crates/stackable-operator/src/config/fragment.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/stackable-operator/src/config/fragment.rs b/crates/stackable-operator/src/config/fragment.rs index a1a89f6be..2cf2d4fb7 100644 --- a/crates/stackable-operator/src/config/fragment.rs +++ b/crates/stackable-operator/src/config/fragment.rs @@ -19,6 +19,17 @@ use super::merge::Merge; #[cfg(doc)] use crate::role_utils::{Role, RoleGroup}; +/// Turns a role group's merged config into the validated config the build step works with. +trait IntoValidated { + /// `ValidatedConfig` of the `Config` to validate. + type Validated; + /// Error thrown when failed to validate a `Config`. + type ConfigError; + + /// Consumes the merged config, as nothing needs it once it is validated. + fn validate(self) -> Result; +} + /// Contains context used for generating validation errors /// /// Constructed internally in [`validate`] From f9d55e47ba09be6329ee7e3304a35bdde795369a Mon Sep 17 00:00:00 2001 From: Maxi Wittich Date: Fri, 13 Nov 2026 10:11:26 +0100 Subject: [PATCH 2/5] Allow trait not being used --- crates/stackable-operator/src/config/fragment.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/stackable-operator/src/config/fragment.rs b/crates/stackable-operator/src/config/fragment.rs index 2cf2d4fb7..b790e37f3 100644 --- a/crates/stackable-operator/src/config/fragment.rs +++ b/crates/stackable-operator/src/config/fragment.rs @@ -20,7 +20,8 @@ use super::merge::Merge; use crate::role_utils::{Role, RoleGroup}; /// Turns a role group's merged config into the validated config the build step works with. -trait IntoValidated { +#[allow(dead_code)] +pub trait IntoValidated { /// `ValidatedConfig` of the `Config` to validate. type Validated; /// Error thrown when failed to validate a `Config`. From 59274abd2541c0b166c50b16849e6120861c4c40 Mon Sep 17 00:00:00 2001 From: Maximilian Wittich <56642549+Maleware@users.noreply.github.com> Date: Fri, 13 Nov 2026 10:51:40 +0100 Subject: [PATCH 3/5] Reword comment Co-authored-by: Techassi --- crates/stackable-operator/src/config/fragment.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/stackable-operator/src/config/fragment.rs b/crates/stackable-operator/src/config/fragment.rs index b790e37f3..f571f39c5 100644 --- a/crates/stackable-operator/src/config/fragment.rs +++ b/crates/stackable-operator/src/config/fragment.rs @@ -25,10 +25,10 @@ pub trait IntoValidated { /// `ValidatedConfig` of the `Config` to validate. type Validated; /// Error thrown when failed to validate a `Config`. - type ConfigError; + type Error; /// Consumes the merged config, as nothing needs it once it is validated. - fn validate(self) -> Result; + fn validate(self) -> Result; } /// Contains context used for generating validation errors From 34898067351092815586afcb35778dfb74ecda6d Mon Sep 17 00:00:00 2001 From: Maximilian Wittich <56642549+Maleware@users.noreply.github.com> Date: Fri, 13 Nov 2026 10:52:11 +0100 Subject: [PATCH 4/5] reword comment to suggestion Co-authored-by: Techassi --- crates/stackable-operator/src/config/fragment.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/stackable-operator/src/config/fragment.rs b/crates/stackable-operator/src/config/fragment.rs index f571f39c5..30d11ae8d 100644 --- a/crates/stackable-operator/src/config/fragment.rs +++ b/crates/stackable-operator/src/config/fragment.rs @@ -27,7 +27,8 @@ pub trait IntoValidated { /// Error thrown when failed to validate a `Config`. type Error; - /// Consumes the merged config, as nothing needs it once it is validated. + /// Consumes and validates self and returns [`Self::Validated`] or [`Self::Error`] if + /// validation failed. fn validate(self) -> Result; } From cc554500529219649d51c2cacd127470cad1a821 Mon Sep 17 00:00:00 2001 From: Maxi Wittich Date: Fri, 13 Nov 2026 10:53:27 +0100 Subject: [PATCH 5/5] change type to error and change docs --- crates/stackable-operator/src/config/fragment.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/stackable-operator/src/config/fragment.rs b/crates/stackable-operator/src/config/fragment.rs index b790e37f3..63c107ef8 100644 --- a/crates/stackable-operator/src/config/fragment.rs +++ b/crates/stackable-operator/src/config/fragment.rs @@ -19,16 +19,16 @@ use super::merge::Merge; #[cfg(doc)] use crate::role_utils::{Role, RoleGroup}; -/// Turns a role group's merged config into the validated config the build step works with. +/// Turns a invalidated struct into the validated counterpart the build step works with. #[allow(dead_code)] pub trait IntoValidated { - /// `ValidatedConfig` of the `Config` to validate. + /// `Validated` counterpart of the struct to validate. type Validated; - /// Error thrown when failed to validate a `Config`. - type ConfigError; + /// `Error` thrown when failed to validate a struct. + type Error; /// Consumes the merged config, as nothing needs it once it is validated. - fn validate(self) -> Result; + fn validate(self) -> Result; } /// Contains context used for generating validation errors