Problem/Motivation
I screwed up. The schema added in #3355087: Support for non-bundle entity types for non-bundle entity type settings:
scheduler.no_bundle_entity_type_settings.*:
type: scheduler_third_party_settings
scheduler_third_party_settings is type: mapping — designed to validate third-party settings nested inside a host config entity. But scheduler.no_bundle_entity_type_settings.{entity_type_id} is a standalone, top-level config object, so its type should be config_object.
Because it's a bare mapping, the schema has no _core or langcode keys. Those are only defined on the config_object base type (core.data_types.schema.yml).
Consequence: a module that wants to ship sensible defaults for its non-bundle entity type via config/install (e.g. mymodule/config/install/scheduler.no_bundle_entity_type_settings.my_entity.yml) cannot. ConfigInstaller always writes _core.default_config_hash to installed config (ConfigInstaller.php ~line 395). With strict config schema checking on (every kernel/functional test, config validation tooling), this throws:
Schema errors for scheduler.no_bundle_entity_type_settings.my_entity with the following errors:
scheduler.no_bundle_entity_type_settings.my_entity:_core missing schema
So integrators are forced to create the config programmatically in hook_install() to dodge the installer (and langcode too). The settings form works fine because it set()s only the scheduler keys.
Steps to reproduce
- Register a Scheduler plugin for a bundleless entity type.
- Ship config/install/scheduler.no_bundle_entity_type_settings..yml with the default keys.
- Install the module in a kernel test (or any context with ConfigSchemaChecker active).
- SchemaIncompleteException: ... :_core missing schema.
Proposed resolution
Type the standalone config as a config_object so it inherits _core/langcode, while keeping the same scheduler keys. e.g.:
scheduler.no_bundle_entity_type_settings.*:
type: config_object
label: 'Scheduler no-bundle entity type settings'
mapping:
expand_fieldset:
type: string
label: '...'
fields_display_mode:
type: string
label: '...'
publish_enable:
type: boolean
# ... remaining keys from scheduler_third_party_settings
Maybe we can re-use the mapping still while making sure it's a config object
AI helped me draft this after discovering in https://git.drupalcode.org/project/ai_context/-/merge_requests/168
Issue fork scheduler-3593940
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jonathan1055 commentedThanks for reporting this and working on it so quickly. When done I can release 2.3.1 if needed. Or if it can wait a few days, there might be another fix to make, to also include in 2.3.1.
Comment #4
mglamanComment #5
mglamanI think it's all done. Probably a good fast follow patch fix, it would help fix hacks on https://git.drupalcode.org/project/ai_context/merge_requests/168 if this was released.
Comment #6
jonathan1055 commentedIt looks good, and thanks for demonstrating with the extra test. I will merge this, then take a decision on how quick to release 2.3.1
Given the major new feature in 2.3.0, I think we should have an update to the README.md and also the documentation on https://project.pages.drupalcode.org/scheduler/ before we release 2.3.1
Comment #8
jonathan1055 commentedMerged. I have opened a new issue #3595246: Invalid query when a non-bundled entity is also not revisionable for the problem discovered in the MR