Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Recently, core started to enforce strict schemas for config entities when using simpletest (https://www.drupal.org/node/2391795). This results in a SchemaIncompleteException for Flag::flagTypeConfig and Flag::linkTypeConfig.
Proposed resolution
To fix this, we need to expand flag.schema.yml to include provided plugin types. Tim Plunkett suggested examining search.schema.yml for examples. Namely, the configuration member of the search.page.* entry at the bottom of the file.
Remaining tasks
Write patch to flag.schema.yml.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#14 | 2409829.14.flag_.flag-config-schema.patch | 1.24 KB | joachim |
#1 | 2409829.1.flagSchemaIncomplete.patch | 443 bytes | socketwench |
Comments
Comment #1
socketwench CreditAttribution: socketwench commentedPartial, incomplete patch.
Comment #2
socketwench CreditAttribution: socketwench commentedBoosting to Critical because if it doesn't get fixed, all the tests will fail and make a mess of things for us poor devs.
Comment #3
joachim CreditAttribution: joachim commentedI still get fails with this patch.
Also, how do we get testbot to test this when the branch tests are failing?
Comment #4
BerdirAsk someone in #drupal-contribute to force a test run, needs adminstrative permissions there. (e.g. me :))
Yes, this is definitely not complete yet.
Comment #5
joachim CreditAttribution: joachim commentedI think there are other problems as well as this that are causing the tests to fail: I tried setting protected $strictConfigSchema = FALSE; on all our test classes, as suggested in the CR, and the tests still fail:
Comment #6
BerdirYes, I helped @socketwench with one pull request that was working on fixing the tests, and we had at least one test that green, I think that was not yet merged, but it didn't get inyet.
Comment #7
joachim CreditAttribution: joachim commentedI am getting errors in all tests.
FlagConfirmFormTest shows this:
At first glance, it looks like the other errors in the other tests are variations on this. (Or at least, I think we can work on that assumption until we make this error go away!)
Comment #8
joachim CreditAttribution: joachim commentedDo you have the URL for the github pull request? I've had a look through the list and nothing's jumping out.
Comment #9
BerdirIt was https://github.com/socketwench/flag-drupal8/pull/120, together with some additional fixes from me in 124. That would be #2410005: [regression] add flag form first step shouldn't have the machine name and link type.
Comment #10
joachim CreditAttribution: joachim commented> flag.flag.test_label_123:flagTypeConfig.i18n missing schema, flag.flag.test_label_123:flagTypeConfig.access_author missing schema,
How do we handle these? They only apply to flags on nodes, so the NodeFlagType plugin.
Comment #11
BerdirThe existing patch here starts with adding the dynamic pattern, now you need to provide the specific schema for each plugin type, e.g. flag.link.confirm (note that the current patch uses the same pattern for both plugins, that needs to change).
Yes, that is annoying for derivate-based plugins that are available for a dynamic list of entity types. I believe there is a alter hook for config schema now, so you could possibly use that?
Comment #12
joachim CreditAttribution: joachim commented> The existing patch here starts with adding the dynamic pattern, now you need to provide the specific schema for each plugin type, e.g. flag.link.confirm (note that the current patch uses the same pattern for both plugins, that needs to change).
Sorry, you've lost me there...
This schema is for the flag config entity, isn't it? Are you saying we need to expand flagTypeConfig and linkTypeConfig into sub-arrays here?
> Yes, that is annoying for derivate-based plugins that are available for a dynamic list of entity types. I believe there is a alter hook for config schema now, so you could possibly use that?
Yup, it's https://api.drupal.org/api/drupal/core!modules!system!system.api.php/fun...
It has lots of warnings on it not to use it :/
Comment #13
BerdirYes, exactly, assuming that the type for link plugins is flag.link.[%parent.link_type], then you need something like this for the confirm form:
And then repeat that for every plugin you have, if they have no configuration, you still need to define it as type mapping without any actual mappings.
Comment #14
joachim CreditAttribution: joachim commentedHere's how far I've got, in case anyone wants to pick it up. I'll unassign the issue for now.
Comment #15
socketwench CreditAttribution: socketwench commentedHmmm, I don't think show_in_links is a boolean. Looks like a string. Maybe it should be a boolean?
Comment #16
webflo CreditAttribution: webflo commented@socketwench: Config schema converts value automatically.
Comment #17
BerdirI would suggest to just disable schema checks and first fix anything that is *not* related to config schema and then get back to this. Probably in #2410005: [regression] add flag form first step shouldn't have the machine name and link type.
Will try to have a look at that issue, unless someone else plans to do that in the next few hours?
Comment #18
BerdirTurns out I was wrong on the generic thing. derivatives are supported, see #2317865: Config schema definitions for plugins aren't applied to their derivatives, so entity:* or so as plugin ID should work and apply to all derivatives.
Comment #19
joachim CreditAttribution: joachim commentedBetter patch at #2541936: Fix config schema.