Problem/Motivation
Quoting myself from #3216089-27: Expose validation constraints (and validatability %) in Config Inspector UI and #3216089-28: Expose validation constraints (and validatability %) in Config Inspector UI:
An idea for a follow-up could be to distinguish between inherited constraints vs local constraints — that would make it clear that for example the
_corekey (which is present in bothcdn.settingsandmedia.settings's Drush output) actually is of the type_core_config_info— so adding a validation constraint there would fix it everywhere.
+
Another follow-up would be to map the FQCNs to the equivalent types:
\Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraintwould becomePrimitiveTypebecause of
* @Constraint( * id = "PrimitiveType", * label = @Translation("Primitive type", context = "Validation") * )\Drupal\cdn\Plugin\Validation\Constraint\CdnDomainConstraintwould becomeCdnDomainbecause of
* @Constraint( * id = "CdnDomain", * label = @Translation("CDN domain", context = "Validation"), * )- and so on
… but that's really just a nice-to-have compared to today, where this information is still painfully difficult to access.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
- Before

- After
-

- Before

- After
-

- Before
-
$ vendor/bin/drush config:inspect --filter-keys=cdn.settings --detail --list-constraints ----------------------------------------- --------- ------------- ------- ----------------------------------------------------------------------------- Key Status Validatable Data Validation constraints ----------------------------------------- --------- ------------- ------- ----------------------------------------------------------------------------- cdn.settings Correct 36% Valid cdn.settings: Correct NOT Valid cdn.settings:_core Correct NOT Valid cdn.settings:_core.default_config_hash Correct NOT Valid cdn.settings:farfuture Correct NOT Valid cdn.settings:farfuture.status Correct Validatable Valid Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraint cdn.settings:langcode Correct NOT Valid cdn.settings:mapping Correct NOT Valid cdn.settings:mapping.conditions Correct NOT Valid cdn.settings:mapping.domain Correct Validatable Valid Drupal\cdn\Plugin\Validation\Constraint\CdnDomainConstraint Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraint cdn.settings:mapping.type Correct NOT Valid cdn.settings:scheme Correct Validatable Valid Drupal\cdn\Plugin\Validation\Constraint\CdnSchemeConstraint Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraint cdn.settings:status Correct Validatable Valid Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraint cdn.settings:stream_wrappers Correct NOT Valid cdn.settings:stream_wrappers.0 Correct Validatable Valid Drupal\cdn\Plugin\Validation\Constraint\CdnStreamWrapperConstraint Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraint ----------------------------------------- --------- ------------- ------- ----------------------------------------------------------------------------- - After
-
$ vendor/bin/drush config:inspect --filter-keys=cdn.settings --detail --list-constraints Legend for Data: ✅❓ → Correct primitive type, detailed validation impossible. ✅✅ → Correct primitive type, passed all validation constraints. ----------------------------------------- --------- ------------- ------ ------------------------ Key Status Validatable Data Validation constraints ----------------------------------------- --------- ------------- ------ ------------------------ cdn.settings Correct 36% ✅❓ cdn.settings: Correct NOT ✅❓ cdn.settings:_core Correct NOT ✅❓ cdn.settings:_core.default_config_hash Correct NOT ✅❓ cdn.settings:farfuture Correct NOT ✅❓ cdn.settings:farfuture.status Correct Validatable ✅✅ ↣ PrimitiveType: { } cdn.settings:langcode Correct NOT ✅❓ cdn.settings:mapping Correct NOT ✅❓ cdn.settings:mapping.conditions Correct NOT ✅❓ cdn.settings:mapping.domain Correct Validatable ✅✅ CdnDomain: { } ↣ PrimitiveType: { } cdn.settings:mapping.type Correct NOT ✅❓ cdn.settings:scheme Correct Validatable ✅✅ CdnScheme: { } ↣ PrimitiveType: { } cdn.settings:status Correct Validatable ✅✅ ↣ PrimitiveType: { } cdn.settings:stream_wrappers Correct NOT ✅❓ cdn.settings:stream_wrappers.0 Correct Validatable ✅✅ CdnStreamWrapper: { } ↣ PrimitiveType: { } ----------------------------------------- --------- ------------- ------ ------------------------
API changes
N/A
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | interdiff_3-5.txt | 422 bytes | ronaldtebrake |
| #7 | 3360991-5.patch | 10.27 KB | ronaldtebrake |
| #5 | constraints-basic-html.txt | 29.97 KB | wim leers |
| #4 | interdiff.txt | 838 bytes | wim leers |
| #4 | 3360991-3.patch | 10.26 KB | wim leers |
Comments
Comment #2
wim leersComment #3
gábor hojtsyLooks like a great improvement indeed!
Comment #4
wim leersFor something more interesting, see
$ vendor/bin/drush config:inspect --filter-keys=editor.editor.basic_html --detail --list-constraints's output after a fresh install (which made me refine the output for Drush because it was impossible to distinguish some things):Comment #5
wim leersHere's a plain text file with the output I quoted in #4 — d.o's formatting makes it unusable 🫣
Comment #6
ronaldtebrake commentedThat drush output, how neat 😍
---
Think we can remove the
return array_mapat the end.Comment #7
ronaldtebrake commentedComment #8
wim leersThanks! 🫣 Dead code indeed :P
Comment #9
wim leers@Gábor Hojtsy gave me commit access at DrupalCon! 🤓😄
Let's ship this!
Comment #11
wim leers