Closed (fixed)
Project:
Experience Builder
Version:
0.x-dev
Component:
Component sources
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 Feb 2025 at 15:58 UTC
Updated:
21 Mar 2025 at 14:14 UTC
Jump to comment: Most recent, Most recent file




Comments
Comment #2
lauriiiComment #3
wim leers#3509037: JavaScriptComponent config entities' `examples` and `enum` do not respect the prop's type just landed and made this trivial to fix.
Comment #4
wim leersComment #6
wim leersTests are proving the problem now 👍
Comment #7
wim leersThis should use
ComponentMetadataRequirementsChecker, which will also mean we'll get examples validated in the future automatically, too — thanks to #3508725: ComponentMetadataRequirementsChecker::check() should validate that the example(s) actually match the JSON schema.Comment #8
wim leersComponentMetadataRequirementsChecker— fails in an interesting way!JsComponentHasValidSdcMetadataConstraintValidatorhas 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 modifying
JavaScriptComponentconfig 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 precisionPHP 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 #3493070: SDC `enum` props should have translatable labels: use `meta:enum`, but it's not.Comment #9
wim leersManually tested in the UI, it works:
👍
Comment #11
wim leersComment #12
nagwani commentedComment #13
wim leers