Add validation constraints to core.menu.schema.yml

Created on 17 April 2024, 8 months ago

Problem/Motivation

core.menu.static_menu_link_overrides has 3 property path that are not yet validatable:

./vendor/bin/drush config:inspect --filter-keys=core.menu.static_menu_link_overrides --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                      
 -------------------------------------------------------------------------------- --------- ------------- ------ -------------------------------------------- 
  core.menu.static_menu_link_overrides                                             Correct   70%           โœ…โ“   ValidKeys: '<infer>'                        
                                                                                                                  LangcodeRequiredIfTranslatableValues: null  
   core.menu.static_menu_link_overrides:                                           Correct   Validatable   โœ…โœ…   ValidKeys: '<infer>'                        
                                                                                                                  LangcodeRequiredIfTranslatableValues: null  
   core.menu.static_menu_link_overrides:_core                                      Correct   Validatable   โœ…โœ…   ValidKeys:                                  
                                                                                                                    - default_config_hash                     
   core.menu.static_menu_link_overrides:_core.default_config_hash                  Correct   Validatable   โœ…โœ…   NotNull: {  }                               
                                                                                                                  Regex: '/^[a-zA-Z0-9\-_]+$/'                
                                                                                                                  Length: 43                                  
                                                                                                                  โ†ฃ PrimitiveType: {  }                       
   core.menu.static_menu_link_overrides:definitions                                Correct   NOT           โœ…โ“   โš ๏ธ  @todo Add validation constraints here   
   core.menu.static_menu_link_overrides:definitions.contact__site_page             Correct   Validatable   โœ…โœ…   ValidKeys: '<infer>'                        
   core.menu.static_menu_link_overrides:definitions.contact__site_page.enabled     Correct   Validatable   โœ…โœ…   โ†ฃ PrimitiveType: {  }                       
   core.menu.static_menu_link_overrides:definitions.contact__site_page.expanded    Correct   Validatable   โœ…โœ…   โ†ฃ PrimitiveType: {  }                       
   core.menu.static_menu_link_overrides:definitions.contact__site_page.menu_name   Correct   NOT           โœ…โ“   โš ๏ธ  @todo Add validation constraints here   
   core.menu.static_menu_link_overrides:definitions.contact__site_page.parent      Correct   NOT           โœ…โ“   โš ๏ธ  @todo Add validation constraints here   
   core.menu.static_menu_link_overrides:definitions.contact__site_page.weight      Correct   Validatable   โœ…โœ…   Range:                                      
                                                                                                                    min: -2147483648                          
                                                                                                                    max: 2147483647                           
                                                                                                                  FullyValidatable: null                      
                                                                                                                  โ†ฃ 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=core.menu.static_menu_link_overrides --detail --list-constraints

Proposed resolution

Add validation constraints to:

  1. definitions
  2. menu_name
  3. parent

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

Active

Version

10.3 โœจ

Component
Configurationย  โ†’

Last updated 3 days ago

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

Production build 0.71.5 2024