I apparently released the Drupal configuration schema cheat sheet 7 years ago (wow!) to help people adopt the then new format to describe configuration structure. I keep getting questions and requests about it, so decided to make a major update to it now and bring it to the present day for Drupal 9.
Updates from 1.5 (April 2015) include:
- Double the pages, more extensive examples and pointers to core definitions
- Includes description of config ordering introduced with Drupal 9.3
- Documents how to pick schema keys for various use cases, such as config entities
- Documents where to put the schema files and when to use multiple
- Explains common string subtypes and recent additions to base scalar types
- Contains a whole section on translatability
- An entire new section to explain basics of mappings and sequences, the most common request
- Explains potential of string keyed sequences 4 or so times, so hope it goes through :)
- Suggests to use common mapping subtypes like mail and text_format
- Covers ignore and undefined
- Adds a whole new intro to dynamic typing to make the examples easier to understand
- Makes all dynamic examples contain all definitions instead of abbreviations for easier understanding
- Uses the same data to explain the [%parent] and [childkey] dynamic typing, to show the differences better
- Cites various common core extension points, such as third party settings on themes and config entities
- Explains advanced properties such as nullable lists
- Updates test base class names for Drupal 9
I regularly receive feedback about people using the cheat sheet, so I hope this will help make config schema somewhat easier to grok. Improvement suggestions still welcome!
Kudos to Rene Bakx for his most recent questions that tipped me over to update the sheet.
The first file name on the
The first file name on the second page is mistyped.
Wow! Is the config schema
Wow! Is the config schema documented anywhere else this extensively? Not to diminish this awesome work in any way - I have referred to the previous version many times - , but “cheat sheet” and “double the pages” seems kind of contradictory :) Maybe this would be more at home at the Drupal documentation Wiki, leaving room for the cheat sheet to be an actual sheet? Bonus: others can help to keep the information up to date. Either way, thanks for this great work!
Yes it is four sheets now but is still pretty short
I think the drupal.org documentation could be updated with this in part and more. There is no copyright on this that would make it not reusable there.
Thanks for this Gabor and all those other helpful things that you have done over the years!
I have a question about this schema configuration, what is the benefice of this usage ?
When I create config entities or configuration I didn't use it ?
Data validation, ordering, translation, etc.
There are various uses. It defines a definite ordering scheme for configuration, so when configuration is resaved, it will be a sensible diff on deployment. It also helps to validate the data, so the configuration structure is as expected. Without schema, either value could be a random value (a list instead of a string for example). Finally, it also supports translation and generation of forms for translation.
Add new comment