Update ConfigInspectorManager::getNodeConstraints() for #3364109: NotNull + PrimitiveType is insufficient validation

Created on 7 August 2023, 11 months ago
Updated 22 August 2023, 10 months ago

Problem/Motivation

Once 📌 Configuration schema & required values: add test coverage for `nullable: true` validation support Fixed lands, MANY (most!) config schema data types will automatically get the NotNull validation constraint.

But … that still is not sufficient validation.

Steps to reproduce

With Config Inspector's latest release, 📌 Configuration schema & required values: add test coverage for `nullable: true` validation support Fixed will show:

$ vendor/bin/drush config:inspect --filter-keys system.date --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        
 ----------------------------------------- --------- ------------- ------ ------------------------------ 
  system.date                               Correct   100%          ✅✅   ValidKeys: '<infer>'          
                                                                           ↣ NotNull: {  }               
   system.date:                             Correct   Validatable   ✅✅   ValidKeys: '<infer>'          
                                                                           ↣ NotNull: {  }               
   system.date:_core                        Correct   Validatable   ✅✅   ValidKeys:                    
                                                                             - default_config_hash       
                                                                           ↣ NotNull: {  }               
   system.date:_core.default_config_hash    Correct   Validatable   ✅✅   NotNull: {  }                 
                                                                           Regex: '/^[a-zA-Z0-9\-_]+$/'  
                                                                           Length: 43                    
                                                                           ↣ PrimitiveType: {  }         
   system.date:country                      Correct   Validatable   ✅✅   ValidKeys: '<infer>'          
                                                                           ↣ NotNull: {  }               
   system.date:country.default              Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }         
                                                                           ↣ NotNull: {  }               
   system.date:first_day                    Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }         
                                                                           ↣ NotNull: {  }               
   system.date:timezone                     Correct   Validatable   ✅✅   ValidKeys: '<infer>'          
                                                                           ↣ NotNull: {  }               
   system.date:timezone.default             Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }         
                                                                           ↣ NotNull: {  }               
   system.date:timezone.user                Correct   Validatable   ✅✅   ValidKeys: '<infer>'          
                                                                           ↣ NotNull: {  }               
   system.date:timezone.user.configurable   Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }         
                                                                           ↣ NotNull: {  }               
   system.date:timezone.user.default        Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }         
                                                                           ↣ NotNull: {  }               
   system.date:timezone.user.warn           Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }         
                                                                           ↣ NotNull: {  }               
 ----------------------------------------- --------- ------------- ------ ------------------------------ 

This is invalid.

Proposed resolution

Require more than PrimitiveType AND more than NotNull! That should lead to:

$ vendor/bin/drush config:inspect --filter-keys system.date --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        
 ----------------------------------------- --------- ------------- ------ ------------------------------ 
  system.date                               Correct   67%           ✅❓   ValidKeys: '<infer>'          
                                                                           ↣ NotNull: {  }               
   system.date:                             Correct   Validatable   ✅✅   ValidKeys: '<infer>'          
                                                                           ↣ NotNull: {  }               
   system.date:_core                        Correct   Validatable   ✅✅   ValidKeys:                    
                                                                             - default_config_hash       
                                                                           ↣ NotNull: {  }               
   system.date:_core.default_config_hash    Correct   Validatable   ✅✅   NotNull: {  }                 
                                                                           Regex: '/^[a-zA-Z0-9\-_]+$/'  
                                                                           Length: 43                    
                                                                           ↣ PrimitiveType: {  }         
   system.date:country                      Correct   Validatable   ✅✅   ValidKeys: '<infer>'          
                                                                           ↣ NotNull: {  }               
   system.date:country.default              Correct   NOT           ✅❓                                 
   system.date:first_day                    Correct   NOT           ✅❓                                 
   system.date:timezone                     Correct   Validatable   ✅✅   ValidKeys: '<infer>'          
                                                                           ↣ NotNull: {  }               
   system.date:timezone.default             Correct   NOT           ✅❓                                 
   system.date:timezone.user                Correct   Validatable   ✅✅   ValidKeys: '<infer>'          
                                                                           ↣ NotNull: {  }               
   system.date:timezone.user.configurable   Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }         
                                                                           ↣ NotNull: {  }               
   system.date:timezone.user.default        Correct   NOT           ✅❓                                 
   system.date:timezone.user.warn           Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }         
                                                                           ↣ NotNull: {  }               
 ----------------------------------------- --------- ------------- ------ ------------------------------ 

Remaining tasks

TBD

User interface changes

None.

API changes

None.

Data model changes

None.

📌 Task
Status

Fixed

Version

2.1

Component

Code

Created by

🇧🇪Belgium Wim Leers Ghent 🇧🇪🇪🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024