During DrupalCon Lille, I spent some time working on, and talking about the configuration validation initiative that is currently happening in Drupal. In this article, I'll give an update on what we worked on during the week.
In a nutshell, over the years we have tended to add more structure to the way that configuration and variables have been saved to Drupal. We want to add more to that, to enable different new parts of Drupal to be more secure about how they work. Configuration schema validation allows Drupal to test that the values that are in a schema correctly conform to the schema that defines it.
This work enables multiple exiting things to improve, such as: Recipies can validate that they don't break config, config split can merge config with more confidence, config import can detect possible breakage of a site before importing, JSON:API/GraphQL/Rest can update config.
There is a meta issue on drupal.org, where we have been tracking a lot of the information about all the different things going on with configuration validation and all the related updates to that. Wim has kept that issue updated, and the last comment there usually shows a list of tickets that can be worked on.
During Drupalcon in Lille, we got the time to discuss some of the open hard blockers that we currently have:
Both of these issues allow us to express more correct structure about keys in a mapping in schemas.
The more difficult of these two is Required Keys, this is because keys can become required based on the configuration of another key. We discussed this issue thoroughly with @Alex Pott, @Wim Leers and @Bircher.
There were a lot of issues still in this issue where test failed because the tests now actually validate the configuration data based on it's schema and we sometimes work with incomplete data in tests. We have added those to a known failures list for now, and will create dedicated follow-up issues later, to ensure that will be fixed in small, dedicated issues later on.
This is now almost back to green on all tests (after we did some last-minute changes on wording of the error messages), so I'm hopeful we can land this in the near future.
One of the awesome things about Drupalcon is the sprint rooms, and more specicifically the contribution friday.
We saw people that wanted to help during the general contribution day on friday, we created issues to add validation contraints to some of the simple configuration schemas that needed updating.
We used the new drush config:inspect --todo command to find low hanging fruit of config schemas that needed to be updated.
- Add validation constraints to olivero.settings
- Add validation constraints to filter.settings
- Add validation constraints to taxonomy.settings
- Add validation constraints to user.settings
- Add validation constraints to dblog.settings
- Add validation constraints to field.settings
- Add validation constraints to media.settings
- Add validation constraints to automated_cron.settings
- Add validation constraints to image.settings
- Add validation constraints to claro.settings
These 10 new issues have been worked on by several people in the issue queue. Most of these still need reviews so that we can get these in, but it will give us more config that is 100% validatable.