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.

Slides from WIm Leers about config validation

What is configuration validation in Drupal?

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.

Progress update

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.

Drupalcon Lille sprint room

Sprint day

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.

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.

Config inspect
Wim & Joris at drupalcon sprint room

What's next?

We need to go trough more of the high hanging fruit to validate some of the more complicated usecases, which will make drupal core (and some contrib/custom) more validatable, where the 16% of property paths that are validatable are in 5 properties.

  1. 10%: views.field.field                   affects 751 property paths, 10% of @todos or  5% of total
  2.  7%: core.entity_form_display.*.*.*      affects 543 property paths,  7% of @todos or  3% of total
  3.  6%: views.filter.boolean                affects 422 property paths,  6% of @todos or  3% of total
  4.  6%: views.view.*                        affects 420 property paths,  6% of @todos or  3% of total
  5.  5%: config_dependencies                 affects 390 property paths,  5% of @todos or  2% of total

We will also create a whole lot of new issues based on the ignore list in both Required Keys and Required Values. These new issues should be thightly scoped and easy to pick up, even without much background about what we've done in the earlier issues.

Follow these issues to stay in the loop: https://www.drupal.org/project/issues/search/drupal?project_issue_followers=&status%5B%5D=1&status%5B%5D=13&status%5B%5D=8&status%5B%5D=14&version%5B%5D=any_11.&version%5B%5D=any_10.&version%5B%5D=any_9.&version%5B%5D=any_8.&issue_tags_op=%3D&issue_tags=Configuration+schema%2C+Distributions+and+Recipes#content

Pictures by Gábor Hojtsy and Bram Driesen from the flickr group https://www.flickr.com/groups/drupalconlille2023/pool/with/53282709101/