Add validation constraints to comment.type.*

Created on 17 June 2024, 8 months ago
Updated 28 June 2024, 8 months ago

Comment type entity is not yet fully validatable:

./vendor/bin/drush config:inspect --filter-keys=comment.type.comment --detail --list-constraints --fields=key,validatability,constraints

>  πŸ€– Analyzing…

 ------------------------------------------------- ------------- ---------------------------------------------------------------------- 
  Key                                               Validatable   Validation constraints                                                
 ------------------------------------------------- ------------- ---------------------------------------------------------------------- 
  comment.type.comment                              91%           ValidKeys: '<infer>'                                                  
   comment.type.comment:                            Validatable   ValidKeys: '<infer>'                                                  
   comment.type.comment:_core                       Validatable   ValidKeys:                                                            
                                                                    - default_config_hash                                               
   comment.type.comment:_core.default_config_hash   Validatable   NotNull: {  }                                                         
                                                                  Regex: '/^[a-zA-Z0-9\-_]+$/'                                          
                                                                  Length: 43                                                            
                                                                  ↣ PrimitiveType: {  }                                                 
   comment.type.comment:dependencies                Validatable   ValidKeys: '<infer>'                                                  
   comment.type.comment:description                 Validatable   Regex:                                                                
                                                                    pattern: '/([^\PC\x09\x0a\x0d])/u'                                  
                                                                    match: false                                                        
                                                                    message: 'Text is not allowed to contain control characters, only   
                                                                  visible characters.'                                                  
                                                                  ↣ PrimitiveType: {  }                                                 
   comment.type.comment:id                          Validatable   Regex:                                                                
                                                                    pattern: '/^[a-z0-9_]+$/'                                           
                                                                    message: 'The %value machine name is not valid.'                    
                                                                  Length:                                                               
                                                                    max: 166                                                            
                                                                  ↣ PrimitiveType: {  }                                                 
   comment.type.comment:label                       Validatable   Regex:                                                                
                                                                    pattern: '/([^\PC])/u'                                              
                                                                    match: false                                                        
                                                                    message: 'Labels are not allowed to span multiple lines or contain  
                                                                  control characters.'                                                  
                                                                  NotBlank: {  }                                                        
                                                                  ↣ PrimitiveType: {  }                                                 
   comment.type.comment:langcode                    Validatable   NotNull: {  }                                                         
                                                                  Choice:                                                               
                                                                    callback:                                                           
                                                                  'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllVali  
                                                                  dLangcodes'                                                           
                                                                  ↣ PrimitiveType: {  }                                                 
   comment.type.comment:status                      Validatable   ↣ PrimitiveType: {  }                                                 
   comment.type.comment:target_entity_type_id       NOT           ⚠️  @todo Add validation constraints to config entity type:           
                                                                  comment.type.*                                                        
   comment.type.comment:uuid                        Validatable   Uuid: {  }                                                            
                                                                  ↣ PrimitiveType: {  }                                                 
 ------------------------------------------------- ------------- ---------------------------------------------------------------------- 

Steps to reproduce

  1. Get a local git clone of Drupal core 11.x.
  2. composer require drupal/config_inspector β€” or manually install https://www.drupal.org/project/config_inspector/releases/2.1.5 β†’ or newer (which supports Drupal 11!)
  3. composer require drush/drush
  4. vendor/bin/drush config:inspect --filter-keys=comment.type.comment --detail --list-constraints

Proposed resolution

Add validation constraints to missing properties.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

More validation πŸš€

Release notes snippet

None.

πŸ“Œ Task
Status

Needs work

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 18 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States mtift Minnesota, USA

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024