Problem/Motivation
Action entity is not yet validatable:
vendor/bin/drush config:inspect --filter-keys=system.action.user_cancel_user_action --detail --list-constraints
โ ๐ค Analyzingโฆ
Legend for Data:
โ
โ โ Correct primitive type, detailed validation impossible.
โ
โ
โ Correct primitive type, passed all validation constraints.
------------------------------------------------------------------ --------- ------------- ------ ----------------------------------------------------------------------------------------------------
Key Status Validatable Data Validation constraints
------------------------------------------------------------------ --------- ------------- ------ ----------------------------------------------------------------------------------------------------
system.action.user_cancel_user_action Correct 79% โ
โ ValidKeys: '<infer>'
system.action.user_cancel_user_action: Correct Validatable โ
โ
ValidKeys: '<infer>'
system.action.user_cancel_user_action:_core Correct Validatable โ
โ
ValidKeys:
- default_config_hash
system.action.user_cancel_user_action:_core.default_config_hash Correct Validatable โ
โ
NotNull: { }
Regex: '/^[a-zA-Z0-9\-_]+$/'
Length: 43
โฃ PrimitiveType: { }
system.action.user_cancel_user_action:configuration Correct NOT โ
โ โ @todo Add validation constraints to ancestor type: action.configuration.user_cancel_user_action
system.action.user_cancel_user_action:dependencies Correct Validatable โ
โ
ValidKeys: '<infer>'
system.action.user_cancel_user_action:dependencies.module Correct NOT โ
โ โ @todo Add validation constraints to ancestor type: config_dependencies
system.action.user_cancel_user_action:dependencies.module.0 Correct Validatable โ
โ
NotBlank: { }
ExtensionName: { }
ExtensionExists: module
โฃ PrimitiveType: { }
system.action.user_cancel_user_action:id Correct Validatable โ
โ
Regex:
pattern: '/^[a-z0-9_\.]+$/'
message: 'The %value machine name is not valid.'
โฃ PrimitiveType: { }
โฃ Length:
max: 166
system.action.user_cancel_user_action:label Correct Validatable โ
โ
Regex:
pattern: '/([^\PC])/u'
match: false
message: 'Labels are not allowed to span multiple lines or contain control characters.'
NotBlank: { }
โฃ PrimitiveType: { }
system.action.user_cancel_user_action:langcode Correct Validatable โ
โ
NotNull: { }
Choice:
callback: 'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllValidLangcodes'
โฃ PrimitiveType: { }
system.action.user_cancel_user_action:plugin Correct Validatable โ
โ
PluginExists:
manager: plugin.manager.action
interface: Drupal\Core\Action\ActionInterface
โฃ PrimitiveType: { }
system.action.user_cancel_user_action:status Correct Validatable โ
โ
โฃ PrimitiveType: { }
system.action.user_cancel_user_action:type Correct NOT โ
โ โ ๏ธ @todo Add validation constraints to config entity type: system.action.*
system.action.user_cancel_user_action:uuid Correct Validatable โ
โ
Uuid: { }
โฃ PrimitiveType: { }
------------------------------------------------------------------ --------- ------------- ------ ----------------------------------------------------------------------------------------------------
Steps to reproduce
- Get a local git clone of Drupal core
11.x
.
composer require drupal/config_inspector
โ or manually install
https://www.drupal.org/project/config_inspector/releases/2.1.5 โ
or newer (which supports Drupal 11!)
composer require drush/drush
vendor/bin/drush config:inspect --filter-keys=system.action.user_cancel_user_action --detail --list-constraints
Proposed resolution
Add validation constraints to:
system.action.*:type
Many tests creates actions by using only id
and plugin
.
Eg.
$action = Action::create([
'id' => 'entity_save_action',
'plugin' => 'entity:save_action:entity_test_mul_changed',
]);
$action->save();
or
$action = Action::create([
'id' => 'entity_delete_action',
'plugin' => 'entity:delete_action:entity_test_mulrevpub',
]);
$action->save();
These tests starts failing if we don't make type: nullable
.
This requires looking at the existing code and admin UI (if any) to understand which values could be considered valid. Eventually this needs to be reviewed by the relevant subsystem maintainer.
For examples, search *.schema.yml
files for the string constraints:
๐
Reach out to @borisson_ or @wimleers in the #distributions-and-recipes
.
Remaining tasks
User interface changes
None.
API changes
None.
Data model changes
More validation ๐
Release notes snippet
None.