Problem/Motivation
Search page config entity is not yet fully validatable:
.vendor/bin/drush config:inspect --filter-keys=search.page.user_search --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
---------------------------------------------------- --------- ------------- ------ ---------------------------------------------------------------------------------------------
search.page.user_search Correct 80% ✅❓ ValidKeys: '<infer>'
search.page.user_search: Correct Validatable ✅✅ ValidKeys: '<infer>'
search.page.user_search:_core Correct Validatable ✅✅ ValidKeys:
- default_config_hash
search.page.user_search:_core.default_config_hash Correct Validatable ✅✅ NotNull: { }
Regex: '/^[a-zA-Z0-9\-_]+$/'
Length: 43
↣ PrimitiveType: { }
search.page.user_search:configuration Correct NOT ✅❓ ❌ @todo Add validation constraints to ancestor type: search.plugin.user_search
search.page.user_search:dependencies Correct Validatable ✅✅ ValidKeys: '<infer>'
search.page.user_search:dependencies.module Correct NOT ✅❓ ❌ @todo Add validation constraints to ancestor type: config_dependencies
search.page.user_search:dependencies.module.0 Correct Validatable ✅✅ NotBlank: { }
ExtensionName: { }
ExtensionExists: module
↣ PrimitiveType: { }
search.page.user_search:id Correct Validatable ✅✅ Regex:
pattern: '/^[a-z0-9_]+$/'
message: 'The %value machine name is not valid.'
Length:
max: 166
↣ PrimitiveType: { }
search.page.user_search:label Correct Validatable ✅✅ Regex:
pattern: '/([^\PC])/u'
match: false
message: 'Labels are not allowed to span multiple lines or contain control characters.'
NotBlank: { }
↣ PrimitiveType: { }
search.page.user_search:langcode Correct Validatable ✅✅ NotNull: { }
Choice:
callback: 'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllValidLangcodes'↣ PrimitiveType: { }
search.page.user_search:path Correct NOT ✅❓ ⚠️ @todo Add validation constraints to config entity type: search.page.*
search.page.user_search:plugin Correct Validatable ✅✅ PluginExists:
manager: plugin.manager.search
interface: Drupal\search\Plugin\SearchInterface
↣ PrimitiveType: { }
search.page.user_search:status Correct Validatable ✅✅ ↣ PrimitiveType: { }
search.page.user_search:uuid Correct Validatable ✅✅ Uuid: { }
↣ PrimitiveType: { }
search.page.user_search:weight Correct Validatable ✅✅ Range:
min: -2147483648
max: 2147483647
FullyValidatable: null
↣ 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=search.page.user_search --detail --list-constraints
Proposed resolution
Add validation constraints to missing properties.
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 #recipes
.
Remaining tasks
User interface changes
None.
API changes
None.
Data model changes
More validation 🚀
Release notes snippet
None.