Add validation constraints to system.site

Created on 25 April 2024, 2 months ago
Updated 26 June 2024, 1 day ago

Problem/Motivation

system.site has 5 property path that are not yet validatable:

vendor/bin/drush config:inspect --filter-keys=system.site --detail --list-constraints
โžœ  ๐Ÿค– Analyzingโ€ฆ

 Legend for Data: 
  โœ…โ“  โ†’ Correct primitive type, detailed validation impossible.
  โœ…โœ…  โ†’ Correct primitive type, passed all validation constraints.
 ---------------------------------------- --------- ------------- ------ --------------------------------------------------------------------------------------------- 
  Key                                      Status    Validatable   Data   Validation constraints                                                                       
 ---------------------------------------- --------- ------------- ------ --------------------------------------------------------------------------------------------- 
  system.site                              Correct   69%           โœ…โ“   ValidKeys: '<infer>'                                                                         
                                                                          LangcodeRequiredIfTranslatableValues: null                                                   
   system.site:                            Correct   Validatable   โœ…โœ…   ValidKeys: '<infer>'                                                                         
                                                                          LangcodeRequiredIfTranslatableValues: null                                                   
   system.site:_core                       Correct   Validatable   โœ…โœ…   ValidKeys:                                                                                   
                                                                            - default_config_hash                                                                      
   system.site:_core.default_config_hash   Correct   Validatable   โœ…โœ…   NotNull: {  }                                                                                
                                                                          Regex: '/^[a-zA-Z0-9\-_]+$/'                                                                 
                                                                          Length: 43                                                                                   
                                                                          โ†ฃ PrimitiveType: {  }                                                                        
   system.site:admin_compact_mode          Correct   Validatable   โœ…โœ…   โ†ฃ PrimitiveType: {  }                                                                        
   system.site:default_langcode            Correct   Validatable   โœ…โœ…   NotNull: {  }                                                                                
                                                                          Choice:                                                                                      
                                                                            callback: 'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllValidLangcodes'  
                                                                          โ†ฃ PrimitiveType: {  }                                                                        
   system.site:langcode                    Correct   Validatable   โœ…โœ…   NotNull: {  }                                                                                
                                                                          Choice:                                                                                      
                                                                            callback: 'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllValidLangcodes'  
                                                                          โ†ฃ PrimitiveType: {  }                                                                        
   system.site:mail                        Correct   Validatable   โœ…โœ…   Email:                                                                                       
                                                                            message: '%value is not a valid email address.'                                            
                                                                          โ†ฃ PrimitiveType: {  }                                                                        
   system.site:mail_notification           Correct   NOT           โœ…โ“   โš ๏ธ  @todo Add validation constraints here                                                    
   system.site:name                        Correct   Validatable   โœ…โœ…   Regex:                                                                                       
                                                                            pattern: '/([^\PC])/u'                                                                     
                                                                            match: false                                                                               
                                                                            message: 'Labels are not allowed to span multiple lines or contain control characters.'    
                                                                          โ†ฃ PrimitiveType: {  }                                                                        
   system.site:page                        Correct   Validatable   โœ…โœ…   ValidKeys: '<infer>'                                                                         
   system.site:page.403                    Correct   NOT           โœ…โ“   โš ๏ธ  @todo Add validation constraints here                                                    
   system.site:page.404                    Correct   NOT           โœ…โ“   โš ๏ธ  @todo Add validation constraints here                                                    
   system.site:page.front                  Correct   NOT           โœ…โ“   โš ๏ธ  @todo Add validation constraints here                                                    
   system.site:slogan                      Correct   Validatable   โœ…โœ…   Regex:                                                                                       
                                                                            pattern: '/([^\PC])/u'                                                                     
                                                                            match: false                                                                               
                                                                            message: 'Labels are not allowed to span multiple lines or contain control characters.'    
                                                                          โ†ฃ PrimitiveType: {  }                                                                        
   system.site:uuid                        Correct   Validatable   โœ…โœ…   Uuid: {  }                                                                                   
                                                                          NotNull: {  }                                                                                
                                                                          โ†ฃ PrimitiveType: {  }                                                                        
   system.site:weight_select_max           Correct   NOT           โœ…โ“   โš ๏ธ  @todo Add validation constraints here                                                    
 ---------------------------------------- --------- ------------- ------ --------------------------------------------------------------------------------------------- 

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=system.site --detail --list-constraints

Proposed resolution

Add validation constraints to:

  1. system.site:mail_notification
  2. system.site:page.403
  3. system.site:page.404
  4. system.site:page.front
  5. system.site:weight_select_max

For examples, search *.schema.yml files for the string constraints: ๐Ÿ˜Š

Reach out to @borisson_ or @wimleers in the #distributions-and-recipes.

Remaining tasks

User interface changes

None.

API changes

Data model changes

More validation ๐Ÿš€

Release notes snippet

None.

๐Ÿ“Œ Task
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Systemย  โ†’

Last updated about 9 hours ago

No maintainer
Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia narendraR Jaipur, India

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

Merge Requests

Comments & Activities

  • Issue created by @narendraR
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia narendraR Jaipur, India
  • Merge request !7723Initial commit โ†’ (Open) created by narendraR
  • Pipeline finished with Failed
    2 months ago
    Total: 1473s
    #156255
  • Pipeline finished with Failed
    2 months ago
    Total: 988s
    #157085
  • Pipeline finished with Failed
    2 months ago
    Total: 1043s
    #157164
  • Pipeline finished with Failed
    2 months ago
    Total: 2949s
    #157342
  • Pipeline finished with Failed
    2 months ago
    Total: 1110s
    #157690
  • Pipeline finished with Failed
    about 2 months ago
    Total: 990s
    #159591
  • First commit to issue fork.
  • Status changed to Needs review about 2 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mikelutz Michigan, USA
  • Pipeline finished with Failed
    about 2 months ago
    Total: 576s
    #166824
  • Status changed to Needs work about 2 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mikelutz Michigan, USA
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States carsoncho

    This all looks correct to me. Config inspector is reporting this at 100% now. Is the reason this is back to Needs work because of the pipelines failing?

  • Pipeline finished with Failed
    about 2 months ago
    Total: 601s
    #169214
  • Pipeline finished with Failed
    about 2 months ago
    Total: 674s
    #169923
  • Pipeline finished with Success
    about 2 months ago
    Total: 650s
    #169953
  • Pipeline finished with Success
    about 2 months ago
    Total: 609s
    #171370
  • Status changed to Needs review about 2 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia narendraR Jaipur, India
  • Status changed to RTBC about 1 month ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    So applied the MR locally.

    Update hook ran just fine

    I'm still able to update the settings without issue

    The proposed schema changes believe make sense.

    +1 from me.

  • Status changed to Needs work about 1 month ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone New Zealand

    I read the IS and the MR. There are new methods in the MR that should be documented.

  • Status changed to Needs review about 1 month ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States carsoncho

    I've added docblock info for those new methods. Ready for review.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 168s
    #184215
  • Status changed to Needs work about 1 month ago
  • The Needs Review Queue Bot โ†’ tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide โ†’ to find step-by-step guides for working with issues.

  • Status changed to Needs review about 1 month ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States mikelutz Michigan, USA

    Fixed coding standards and rebased to see if the validation checker can resolve updated dependencies.

  • Pipeline finished with Success
    about 1 month ago
    Total: 499s
    #184313
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Left 1 question on the MR.

  • Pipeline finished with Success
    29 days ago
    Total: 598s
    #185664
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia narendraR Jaipur, India

    Feedback addressed.

  • Status changed to RTBC 24 days ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Believe feedback has been addressed.

  • Status changed to Needs work 16 days ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    I've added some comments to the MR and 1 that I think should have a follow up created for.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium borisson_ Mechelen, ๐Ÿ‡ง๐Ÿ‡ช

    Followup created: ๐Ÿ“Œ Add PHP_INT_MAX to integer schema configuration Active

Production build 0.69.0 2024