Problem/Motivation
Schema configuration is optional and that can lead to missing configuration values, that are actually required for proper functioning of system. That's why it should be supported that some configuration options are defined as required.
This functionality would improve configuration quality and it would reduce update problems, or wrong configurations stored from UI, etc.
Proposed resolution
We can use same logic as it already exists for kwalify:
http://www.kuwata-lab.com/kwalify/ruby/users-guide.01.html#schema-rules (offline in 2023 😭) https://pykwalify.readthedocs.io/en/unstable/validation-rules.html#required
To add "required" option, that is by default: false, and then we can start using that in schema.
Remaining tasks
- add support for new schema configuration option
- start using it in trait
SchemaCheckTrait
- as first use case, use new feature for "langcode" and get rid of hacky part of code:
// We'd like to verify that the top-level type is either config_base,
// config_entity, or a derivative. The only thing we can really test though
// is that the schema supports having langcode in it. So add 'langcode' to
// the data if it doesn't already exist.
if (!isset($config_data['langcode'])) {
$config_data['langcode'] = 'en';
}
Comments
Comment #12
mattew commentedIt seems that this issue is the origin of the problem I point out here?
Comment #14
wim leersFix external link.
Comment #16
wim leersThis is actually happening now! See #3427641: [meta] Config validation for a more reliable Drupal + reliable Recipes from the start 😄