Add validation constraints to core.menu.schema.yml

Created on 17 April 2024, 7 months ago
Updated 17 July 2024, 4 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

Needs work

Version

10.3

Component
Configuration 

Last updated 1 day 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