- Issue created by @wim leers
In HEAD:
ComponentValidationTest
) pass: /**
* @testWith ["ℹ︎non_existing_field_type␟value", "Invalid expression: the \"non_existing_field_type\" field type does not exist."]
* ["ℹ︎string␟non_existing_field_property", "Invalid expression: the \"string field\" type does not have a field property \"non_existing_field_property\"."]
* ["nonsense", "Invalid structured data expression."]
* ["ℹ︎␜entity:node␝title␞␟value", "A \"FieldPropExpression\" was provided, but expected one of \"FieldTypePropExpression\", \"FieldTypeObjectPropsExpression" or \"ReferenceFieldTypePropExpression\"."]
*
* @see `type: experience_builder.generated_field_explicit_input_ux`
* @covers \Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase
*/
public function testInvalidPropFieldDefinitionExpression(string $expression, string $expected_message): void {
$settings = $this->entity->getSettings();
$settings['prop_field_definitions']['text']['expression'] = $expression;
$this->entity->setSettings($settings);
$this->assertValidationErrors(['settings.prop_field_definitions.text.default_value' => $expected_message]);
}
diff --git a/config/schema/experience_builder.schema.yml b/config/schema/experience_builder.schema.yml
index 5f8d95ecb..9e8fd23e8 100644
--- a/config/schema/experience_builder.schema.yml
+++ b/config/schema/experience_builder.schema.yml
@@ -394,13 +394,15 @@ experience_builder.generated_field_explicit_input_ux:
type: field.value.[%parent.%parent.field_type]
# @todo Add validation constraint because this is only *conditionally* nullable: if the SDC prop is optional
nullable: true
- # The default value must be retrievable
+ # The default value must be retrievable.
expression:
type: string
- label: ''
- constraints: { }
- # @todo Add `StructuredDataPropExpression` validation constraint that fails if StructuredDataPropExpression::fromString() fails
- # StructuredDataPropExpression: [field_type]
+ label: 'The expression'
+ constraints:
+ ValidStructuredDataPropExpression:
+ - FieldTypePropExpression
+ - FieldTypeObjectPropsExpression
+ - ReferenceFieldTypePropExpression
experience_builder.component_source_settings.js:
constraints:
ValidStructuredDataPropExpression
validation constraint to make the above test coverage pass :)
None.