Problem/Motivation

Sibling issue for config entities: #2869792: [meta] Add constraints to all config entity types.

Similar as we want to expose UPDATE functionality for config entities, (see #2869792: [meta] Add constraints to all config entity types / #2300677: JSON:API POST/PATCH support for fully validatable config entities) we want to also add support for simple configuration, see #2911319: Provide a single command to install & run Drupal / #2949888: Enhance config schema for richer default experiences).

In order to safely expose configuration entities we need to add constrains to simple configurations, like the system.site configuration.

Proposed resolution

Add validation to all simple config in core.

  • Find all non-test type: config_object occurrences in Drupal core:
    grep -r --include=\*.schema.yml --exclude=*/tests/* 'type: config_object' ./core
    
  • There's 50 in 11.x on Apr 29, 2024 👆:
    $ grep -r --include=\*.schema.yml --exclude=*/tests/* 'type: config_object' ./core | wc -l
          50
    
  • In the Standard install profile, there's 38:
    $ ./vendor/bin/drush ev "print count(array_filter(\Drupal::service('config.typed')->getDefinitions(), fn (array \$def) => (\$def['type'] ?? '') === 'config_object'))"
    38
    
  • of which (currently) 22 are fully validatable:
    $ ./vendor/bin/drush ev "print count(array_filter(\Drupal::service('config.typed')->getDefinitions(), fn (array \$def) => (\$def['type'] ?? '') === 'config_object' && array_key_exists('FullyValidatable', \$def['constraints'] ?? [])))"
    22
    

Remaining tasks

So let's generate a TODO list for us:
./vendor/bin/drush ev "\$simple = array_filter(\Drupal::service('config.typed')->getDefinitions(), fn (array \$def) => (\$def['type'] ?? '') === 'config_object'); print implode(\"\n\", array_map(fn (\$name, \$def) => '<li>' . ((array_key_exists('FullyValidatable', \$def['constraints'] ?? [])) ? '✅' : '') . '<code>' . \$name .'

', array_keys(\$simple), array_values(\$simple)))"

The output of 👆 copy/pasted into this issue summary:

  • theme_settings
  • core.extension
  • core.menu.static_menu_link_overrides
  • announcements_feed.settings
  • automated_cron.settings
  • comment.settings
  • contact.settings
  • dblog.settings
  • field.settings
  • field_ui.settings
  • file.settings
  • filter.settings
  • image.settings
  • menu_ui.settings
  • node.settings
  • search.settings
  • system.site
  • system.maintenance
  • system.cron
  • system.date
  • system.diff
  • system.logging
  • system.performance
  • system.theme
  • system.file
  • system.image
  • system.image.gd
  • system.mail
  • system.advisories
  • system.feature_flags
  • taxonomy.settings
  • text.settings
  • update.settings
  • user.settings
  • user.mail
  • user.flood
  • views.settings

(See the Child issues in the sidebar to find the issues for the not-yet-validatable ones.)

Total: 22/50 = 44%
Standard: 22/38 = 58%

Last updated: April 29, 2024.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

dawehner created an issue. See original summary.

dawehner’s picture

Issue summary: View changes
dawehner’s picture

Title: Add constraints to all config entity types » Add constraints to all simple configuration
wim leers’s picture

Issue tags: +Configuration system

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

wim leers’s picture

#2969065: Use typed config validation constraints for validation of cdn.settings simple config landed; the CDN module in contrib now has configuration validation for its simple config.

wim leers’s picture

(And #2870435: Support additional stream wrappers just added another validation constraint for a new config key-value pair.)

geek-merlin’s picture

This is exciting. I'll love to adopt this.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

wim leers’s picture

Title: Add constraints to all simple configuration » [meta] Add constraints to all simple configuration
Priority: Normal » Major
Issue summary: View changes
Issue tags: +Configuration schema, +validation
Related issues: +#3412084: Follow-up for #3364109: opt in already validatable simple config to FullyValidatable

We're well on our way now.

See https://www.drupal.org/node/3404425. Thanks to #3391990: Automated report on core config validatability and #3412551: Improve #3391990: add % labels, surface (fully) validatable object counts, debug the sudden decline post we now know automatically which are the currently fully validatable

  1. comment.settings
  2. menu_ui.settings
  3. node.settings
  4. system.maintenance
  5. system.feature_flags
  6. taxonomy.settings

However, this issue still surfaced one additional need not yet met: a definition of done. I think that the definition here is: all type: config_object subtypes in Drupal core must have the FullyValidatable constraint on them.

Before creating that listing by hand, let's first focus on the simple config that is part of the Standard install profile. That's what https://project.pages.drupalcode.org/config_inspector/ is currently visualizing.

wim leers’s picture

Issue summary: View changes
wim leers’s picture

wim leers’s picture

Issue summary: View changes

Had some fun with drush and the config.typed service to semi-automate keeping this plan issue up-to-date 😊

wim leers’s picture

Issue summary: View changes

Oops, that was done against #3422862: Add validation constraints to book.settings 😅

Rather than listing explicit issues in the summary, please see the child issues in the sidebar — that makes it easier to keep this up-to-date.

wim leers’s picture

Core just gained new simple config: layout_builder.settings was added in #3043330: Reduce the number of field blocks created for entities (possibly to zero) and being marked validatable in #3426429: Mark layout_builder.settings fully validatable.

wim leers’s picture

Issue summary: View changes

Last update of IS was on Feb 21. Updated for current state 👍

wim leers’s picture

Issue summary: View changes

Updated stats in the issue summary again. Big bump! 🥳

phenaproxima’s picture

Issue summary: View changes
wim leers’s picture

Issue summary: View changes

Exactly half of Standard's simple config is now fully validatable!

wim leers’s picture

narendrar’s picture

sdc_tags.settings in above list does not seems to be part of core.

wim leers’s picture

Issue summary: View changes

#32: You're right! This was due to a contrib module I was testing. Apologies, fixed that!

In the mean time, two more have landed:

  1. #3437325: Add validation constraints to system.date
  2. #3439620: Add validation constraints to system.advisories
phenaproxima’s picture

bbrala’s picture

Issue summary: View changes
bbrala’s picture

bbrala’s picture

bbrala’s picture

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.