.../Drupal/Core/Config/Schema/SchemaCheckTrait.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php b/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php index 66355a2a3b..5230a2a7d7 100644 --- a/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php +++ b/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php @@ -61,9 +61,26 @@ public function checkConfigSchema(TypedConfigManagerInterface $typed_config, $co // Also perform explicit validation. Note this does NOT require every node // in the config schema tree to have validation constraints defined. $violations = $this->schema->validate(); + $ignored_validation_constraint_messages = [ + // @see \Drupal\Core\Config\Plugin\Validation\Constraint\ConfigExistsConstraint::$message + // @todo Remove this in https://www.drupal.org/project/drupal/issues/3362453 + "The '.*' config does not exist.", + // @see \Drupal\Core\Extension\Plugin\Validation\Constraint\ExtensionExistsConstraint::$moduleMessage + // @see \Drupal\Core\Extension\Plugin\Validation\Constraint\ExtensionExistsConstraint::$themeMessage + // @todo Remove this in https://www.drupal.org/project/drupal/issues/3362456 + "Module '.*' is not installed.", + "Theme '.*' is not installed.", + // @see \Drupal\Core\Plugin\Plugin\Validation\Constraint\PluginExistsConstraint::$unknownPluginMessage + // @todo Remove this in https://www.drupal.org/project/drupal/issues/3362457 + "The '.*' plugin does not exist.", + ]; + $filtered_violations = array_filter( + iterator_to_array($violations), + fn (ConstraintViolation $v) => preg_match(sprintf("/^(%s)$/", implode('|', $ignored_validation_constraint_messages)), (string) $v->getMessage()) !== 1 + ); $validation_errors = array_map( fn (ConstraintViolation $v) => sprintf("[%s] %s", $v->getPropertyPath(), (string) $v->getMessage()), - iterator_to_array($violations) + $filtered_violations ); $errors = array_merge($errors, $validation_errors); if (empty($errors)) {