Problem/Motivation
Given the following config schema (which stores an array of plugin configurations, keyed by plugin id):
plugin_configurations:
type: sequence
label: 'Plugin configurations'
sequence:
- type: <module_name>.<plugin_type>.plugin.[%key]
the magic %key
item is very likely to point to a plugin derivative (e.g. entity:node), but config schemas can not be keyed with a wildcard like <module_name>.<plugin_type>.plugin.entity:*
.
Proposed resolution
Figure out a solution.
Remaining tasks
Implement the solution :)
User interface changes
None.
API changes
A small API addition.
Comments
Comment #1
vijaycs85Module name and plugin_type aren't part of config? if yes, we can get them dynamically. Since the issue summary doesn't have the whole schema, I'm assuming config like this:
then schema would be:
Comment #2
Gábor HojtsySo my understanding this is for cases where %key is compound data in itself and you want to provide schema for wildcard types by breaking up that compound data. One way to do that is if the data contains parts of that compound key as individual data elements, eg. 'generic_type: entity' if 'entity' was part of %key.
Comment #3
amateescu CreditAttribution: amateescu commentedModule name and plugin type have nothing to do with the problem here, they were just written in the OP as generic strings. Here is the exact config data and schema which should detail the problem a bit better:
Config data:
And the config config schema:
@Gábor Hojtsy, the problem with that approach is that every plugin/config entity author will have to include it manually in their plugin configuration just for the sake of config schema, and I seriously doubt that will happen :/
Comment #4
Gábor Hojtsy@amateescu: we do have a history of modifying config structure in the interest of it making sense for schema instead of introducing more exotic typing solutions to core. I think there is a tradeoff there between schema system and docs complexity and some simple patterns that people need to apply. I guess it depends on the solution proposal for this problem :)
Comment #5
vijaycs85@amateescu, sorry for #1. I didn't really get the problem.
Can we create a data type for all common config elements.
Comment #6
Gábor HojtsyI don't think it is at all possible to say plugin config in general will contain a default value especially not boolean default value and that hey would depend on bundles...
Comment #7
Gábor HojtsySounds like a duplicate of #2317865: Config schema definitions for plugins aren't applied to their derivatives which was resolved since then.