- Issue created by @lauriii
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
🐛 js_component examples and enum do not respect the prop type Active just landed and made this trivial to fix.
- Merge request !719Resolve #3509186 "Code components optional props required examples" → (Merged) created by wim leers
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
This should use
ComponentMetadataRequirementsChecker
, which will also mean we'll get examples validated in the future automatically, too — thanks to 📌 ComponentMetadataRequirementsChecker::check() should validate that the example(s) actually match the JSON schema Active . - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
- New constraint validator that calls
ComponentMetadataRequirementsChecker
— fails in an interesting way! - Realize it A) must only run after
JsComponentHasValidSdcMetadataConstraintValidator
has verified it works — this is not possible in Drupal's Symfony validation constraint setup. So: merge it.Then realize B) that it overlaps with
\Drupal\experience_builder\Plugin\Validation\Constraint\IsStorablePropShapeConstraintValidator
.
Solution: expand
JsComponentHasValidSdcMetadata
(+ rename) and removeIsStorablePropShapeConstraintValidator
. Less precise validation errors, but simpler code. And it even makes this MR a net reduction in LoC!
💁♂️ We can work on making the validation errors precisely target the faulty property path value in the config entity later, if there is a need for that. Because the XB code component editor UI does not even allow creating invalid ones — so only people manually modifyingJavaScriptComponent
config entity YAML exports and then importing them will ever even see these errors.P.S.: the
Implicit conversion from float 3.14 to int loses precision
PHP deprecation warning is due to a core bug:\Drupal\options\Plugin\Field\FieldType\ListItemBase::simplifyAllowedValues()
uses the value of each list option as an array key. This works fine for strings and ints (both valid array key indices), but not floats. Try running$test = [3.14 => 'test'];
on PHP >=8.1 and you'll see the same. I first thought this was caused by ✨ Enum vales do not have translatable labels Active , but it's not. - New constraint validator that calls
-
wim leers →
committed 73361f4a on 0.x
Issue #3509186 by wim leers, lauriii: Code components: optional...
-
wim leers →
committed 73361f4a on 0.x
Automatically closed - issue fixed for 2 weeks with no activity.