diff options
author | Pierre Dureau <31905-pdureau@users.noreply.drupalcode.org> | 2025-05-09 19:13:59 +0200 |
---|---|---|
committer | Pierre Dureau <31905-pdureau@users.noreply.drupalcode.org> | 2025-05-09 19:13:59 +0200 |
commit | d3fa5fa93b36ce94aceea3211fae0413c6483318 (patch) | |
tree | ec3a407961cae7f89fdef212cd5bc2eaf7cca7b1 | |
parent | 1cf42783caaef4797a21fcae68a6838ce73e45a1 (diff) | |
download | drupal-d3fa5fa93b36ce94aceea3211fae0413c6483318.tar.gz drupal-d3fa5fa93b36ce94aceea3211fae0413c6483318.zip |
Issue #3519917 by penyaskito, pdureau, larowlan: Disable additionalProperties in slots in SDC json schema
-rw-r--r-- | core/assets/schemas/v1/metadata-full.schema.json | 1 | ||||
-rw-r--r-- | core/assets/schemas/v1/metadata.schema.json | 1 | ||||
-rw-r--r-- | core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php | 13 |
3 files changed, 15 insertions, 0 deletions
diff --git a/core/assets/schemas/v1/metadata-full.schema.json b/core/assets/schemas/v1/metadata-full.schema.json index 8cda1cb413b2..ac275eb1bdfb 100644 --- a/core/assets/schemas/v1/metadata-full.schema.json +++ b/core/assets/schemas/v1/metadata-full.schema.json @@ -4,6 +4,7 @@ "$defs": { "slotDefinition": { "type": "object", + "additionalProperties": false, "patternProperties": { "^[a-zA-Z0-9_-]+$": { "type": "object", diff --git a/core/assets/schemas/v1/metadata.schema.json b/core/assets/schemas/v1/metadata.schema.json index b8e6b6119b30..5e5c753360fd 100644 --- a/core/assets/schemas/v1/metadata.schema.json +++ b/core/assets/schemas/v1/metadata.schema.json @@ -4,6 +4,7 @@ "$defs": { "slotDefinition": { "type": "object", + "additionalProperties": false, "patternProperties": { "^[a-zA-Z0-9_-]+$": { "type": "object", diff --git a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php index 84d87390552d..7e706edcfe0e 100644 --- a/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php @@ -124,6 +124,19 @@ class ComponentValidatorTest extends TestCase { ]; yield 'invalid slot (type)' => [$cta_with_invalid_slot_type]; + $cta_with_invalid_slot_name = $valid_cta; + $cta_with_invalid_slot_name['slots'] = [ + 'valid_slot' => [ + 'title' => 'Valid slot', + 'description' => 'Valid slot description', + ], + 'invalid slot' => [ + 'title' => 'Invalid slot', + 'description' => 'Slot name cannot have spaces', + ], + ]; + yield 'invalid slot (name with spaces)' => [$cta_with_invalid_slot_name]; + $cta_with_invalid_variant_title_type = $valid_cta; $cta_with_invalid_variant_title_type['variants'] = [ 'valid_variant' => [ |