Problem/Motivation

#3360991: TypedData instances created by TypedConfigManager::createFromNameAndData() are incomplete made a critical change in \Drupal\Core\Config\TypedConfigManager::createFromNameAndData(), which requires \Drupal\config_inspector\Controller\ConfigInspectorController::formatTree() to be modified, and possibly other code.

Steps to reproduce

Visit /admin/reports/config-inspector/field.field.block_content.basic.body/tree. It crashes:

TypeError: Drupal\config_inspector\ConfigSchemaValidatability::getConstraints(): Return value must be of type array, null returned in Drupal\config_inspector\ConfigSchemaValidatability->getConstraints() (line 63 of modules/contrib/config_inspector/src/ConfigSchemaValidatability.php).

Also visible in CI tests: https://www.drupal.org/pift-ci-job/2686221

Proposed resolution

Detect >=10.1.x and use different logic then.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new2.17 KB
wim leers’s picture

StatusFileSize
new1.7 KB
new3.04 KB

Similar thing in ::formatList() 👍

wim leers’s picture

Assigned: wim leers » Unassigned
Status: Needs review » Reviewed & tested by the community

Now green on 10.1.x, while still green on 9.5.x and 10.0.x! 🚢

  • Wim Leers committed 67132ca3 on 2.1.x
    Issue #3373570 by Wim Leers: #3360991 changed TypedConfigManager::...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed
wim leers’s picture

Assigned: Unassigned » wim leers
Status: Fixed » Needs work

Similar problems exist in the Drush commands, but they do not have test coverage.

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new2.91 KB
wim leers’s picture

Status: Needs review » Needs work

#8 still has a bug:

$ vendor/bin/drush config:inspect --filter-keys field.field.block_content.basic.body --detail --strict-validation --list-constraints
 Legend for Data: 
  ✅❓  → Correct primitive type, detailed validation impossible.
  ✅✅  → Correct primitive type, passed all validation constraints.
 ---------------------------------------------------------------------------- --------- ------------- ------ ----------------------------------------------------------- 
  Key                                                                          Status    Validatable   Data   Validation constraints                                     
 ---------------------------------------------------------------------------- --------- ------------- ------ ----------------------------------------------------------- 
  field.field.block_content.basic.body                                         Correct   67%           ✅❓                                                              
   field.field.block_content.basic.body:field.field.block_content.basic.body   Correct   NOT           ✅❓                                                              
   field.field.block_content.basic.body:_core                                  Correct   NOT           ✅❓                                                              
   field.field.block_content.basic.body:_core.default_config_hash              Correct   NOT           ✅❓                                                              
   field.field.block_content.basic.body:bundle                                 Correct   Validatable   ✅✅   NotNull: {  }                                              
                                                                                                              ↣ PrimitiveType: {  }                                      
   field.field.block_content.basic.body:default_value                          Correct   Validatable   ✅✅   NotNull: {  }       

The first line after the top-level key is wrong: field.field.block_content.basic.body:field.field.block_content.basic.body does not make sense.

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new3.5 KB

Fixes #9:

$ vendor/bin/drush config:inspect --filter-keys field.field.block_content.basic.body --detail --strict-validation --list-constraints
 Legend for Data: 
  ✅❓  → Correct primitive type, detailed validation impossible.
  ✅✅  → Correct primitive type, passed all validation constraints.
 ----------------------------------------------------------------- --------- ------------- ------ ----------------------------------------------------------- 
  Key                                                               Status    Validatable   Data   Validation constraints                                     
 ----------------------------------------------------------------- --------- ------------- ------ ----------------------------------------------------------- 
  field.field.block_content.basic.body                              Correct   67%           ✅❓                                                              
   field.field.block_content.basic.body:                            Correct   NOT           ✅❓                                                              
   field.field.block_content.basic.body:_core                       Correct   NOT           ✅❓                                                              
   field.field.block_content.basic.body:_core.default_config_hash   Correct   NOT           ✅❓                                                              
   field.field.block_content.basic.body:bundle                      Correct   Validatable   ✅✅   NotNull: {  }                                              
                                                                                                   ↣ PrimitiveType: {  }                                      
   field.field.block_content.basic.body:default_value               Correct   Validatable   ✅✅   NotNull: {  }  

👍

Still need to manually test on 9.5.x and 10.0.x.

wim leers’s picture

Assigned: wim leers » Unassigned
Status: Needs review » Reviewed & tested by the community

Tested on 10.0.x, works fine 👍

  • Wim Leers committed ae8bf52d on 2.1.x
    Issue #3373570 by Wim Leers: #3360991 changed TypedConfigManager::...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed

Wim Leers credited fgm.

Wim Leers credited roderik.

wim leers’s picture

Marked #3378865: getConstraints() is typed array but may return null as a duplicate. Crediting all who contributed there!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.