Problem/Motivation
It is common practice for a module to provide a configuration schema when it makes use of configuration entities, and context currently does not. Read What are schema files used for? for reasons why including a schema is important.
Proposed resolution
Provide a schema that is broken down in the following way:
- General configuration schema
- Schemas for each condition
- Schemas for each reaction
- We're just going from loosely typed data to more strictly typed data. We may want to consider an update hook to load and resave all configs to force data to get properly typed.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | interdiff-18-21.txt | 425 bytes | paulocs |
| #21 | context-2953766-21.patch | 4.22 KB | paulocs |
| #18 | interdiff_17-18.txt | 2.55 KB | deaom |
| #18 | context-2953766-18.patch | 4.17 KB | deaom |
| #17 | interdiff_14-16.txt | 744 bytes | deaom |
Comments
Comment #2
WidgetsBurritos commentedThis patch isn't complete but it's a start. The blocks conditions is a bit more complicated than the rest, so that will require some additional work.
Also I haven't included any sort of update hook yet to force a resave of the configuration. Not sure if that's desired or not. Wouldn't be too difficult to do.
Comment #3
WidgetsBurritos commentedWhoops. Forgot to attach the file.
Comment #4
Chris Charlton+1 for this support.
Comment #5
bighappyface commentedComment #6
bighappyface commented#3 LGTM
* Confirmed new kernel test
* Confirmed use of schemas and validation of context configs
Comment #7
bighappyface commented@boshtian may we have your help with review and/or merging?
Comment #8
boshtian commentedI'll check this today and get back with feedback. Thank you for patience.
Comment #9
boshtian commentedI checked this and most of it looks good, nice work WidgetsBurritos. But as he mentioned in the first comment, the Blocks reactions are missing from schema and I also noticed that Region reactions are missing.
If anyone is able to put in some additional work in this and I can review it later, that would be great. Otherwise I'll see if I can spend some time on this during this week and get back with the updated patch.
Comment #10
boshtian commentedComment #11
deaom commentedAdded the missing schema for block reactions and region reactions, patch is attached and also the interdiff.
Comment #12
deaom commentedChanging the tag to needs review.
Comment #13
strozx commentedI have reviewed it and it works so moving this to "Reviewed".
Comment #14
jaypanUpdating patch:
1) The plugin.reaction configuration data type needed to be defined in context.data_types.schema.yml, so that other modules can add reaction plugin configuration definitions.
2) The order of the definitions in context.schema.yml needs reordering - the reaction defintions need to come after the context plugin definition. Otherwise plugin definitions from other modules are not picked up.
Comment #15
jaypanComment #16
paulocsComment #17
deaom commentedThe updated patch has some missing schemas. (conditions.request_path_exclusion, reactions.blocks.blocks and reactions.blocks.saved). Attached is the patch for the conditions.request_path_exclusion and reactions.blocks.saved. I do not know how to add the reactions.blocks.blocks as my attempt from previous patch was not correct and any changes I made to schema trying to follow new patch logic it only gives me more missing schema errors. So if anyone has any ideas, please add the missing schema for the reactions.blocks.blocks. So marking this as needs work.
Comment #18
deaom commentedO.k., so I think I managed to add the reactions.blocks.blocks to schema. I also added the view_inclusion condition and corrected the include_default_blocks to integer instead of boolean. Somebody please check and test it.
Comment #20
paulocsSet to needs review because no specific problems were found in the tests and it was build successfully.
Comment #21
paulocsPatch #18 is almost there. I added the page_title reaction that was missing.
Comment #22
paulocsInterdiff
Comment #24
paulocsComment #26
paulocsFixed in dev branch.
Thanks @all.