diff --git a/crates/fj-core/src/objects/object.rs b/crates/fj-core/src/objects/object.rs index 3cddf3f7ae..c303532c9e 100644 --- a/crates/fj-core/src/objects/object.rs +++ b/crates/fj-core/src/objects/object.rs @@ -4,7 +4,7 @@ use crate::{ Surface, Vertex, }, storage::{Handle, HandleWrapper, ObjectId}, - validate::{Validate, ValidationError}, + validate::{Validate, ValidationConfig, ValidationError}, }; macro_rules! object { @@ -40,6 +40,15 @@ macro_rules! object { )* } } + + /// Validate the object with a pre-defined validation configuration + pub fn validate_with_config(&self, config: &ValidationConfig, errors: &mut Vec) { + match self { + $( + Self::$ty(object) => object.validate_with_config(config, errors), + )* + } + } } impl Object { diff --git a/crates/fj-core/src/services/validation.rs b/crates/fj-core/src/services/validation.rs index c40cce03df..6f674a3415 100644 --- a/crates/fj-core/src/services/validation.rs +++ b/crates/fj-core/src/services/validation.rs @@ -72,6 +72,10 @@ impl State for Validation { match command { ValidationCommand::ValidateObject { object } => { + match self.config { + Some(c) => object.validate_with_config(&c, &mut errors), + None => object.validate(&mut errors), + } object.validate(&mut errors); for err in errors {