Skip to content

Commit 2d75f25

Browse files
committed
clarify XSD for formElements allowed settings
In an attempt to resolve #14140, new complex types have been defined for every UI component specified in `ui_settings.xsd` line 49 (valid attribute codes for "formElement"). These complex types only include the `<settings>` child node, along with any grandchildren that pertain specifically to that form element (no `abstractSettings`). Finally, `ui_configuration.xsd` has been updated with a new group holding these complex types, and the corresponding validation for the `<formElements>` tag references this new group rather than the existing, more general group.
1 parent 61814ad commit 2d75f25

File tree

15 files changed

+202
-14
lines changed

15 files changed

+202
-14
lines changed

app/code/Magento/Ui/etc/ui_configuration.xsd

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,26 @@
209209
</xs:choice>
210210
</xs:group>
211211

212+
<xs:group name="formElementsConfig">
213+
<xs:choice>
214+
<xs:element name="hidden" type="formElementHidden" maxOccurs="unbounded"/>
215+
<xs:element name="file" type="formElementFile" maxOccurs="unbounded"/>
216+
<xs:element name="input" type="formElementInput" maxOccurs="unbounded"/>
217+
<xs:element name="date" type="formElementDate" maxOccurs="unbounded"/>
218+
<xs:element name="boolean" type="formElementBoolean" maxOccurs="unbounded"/>
219+
<xs:element name="checkbox" type="formElementCheckbox" maxOccurs="unbounded"/>
220+
<xs:element name="checkboxset" type="formElementCheckboxset" maxOccurs="unbounded"/>
221+
<xs:element name="email" type="formElementEmail" maxOccurs="unbounded"/>
222+
<xs:element name="select" type="formElementSelect" maxOccurs="unbounded"/>
223+
<xs:element name="multiselect" type="formElementMultiselect" maxOccurs="unbounded"/>
224+
<xs:element name="text" type="formElementText" maxOccurs="unbounded"/>
225+
<xs:element name="textarea" type="formElementTextarea" maxOccurs="unbounded"/>
226+
<xs:element name="price" type="formElementPrice" maxOccurs="unbounded"/>
227+
<xs:element name="radioset" type="formElementRadioset" maxOccurs="unbounded"/>
228+
<xs:element name="wysiwyg" type="formElementWysiwyg" maxOccurs="unbounded"/>
229+
</xs:choice>
230+
</xs:group>
231+
212232
<xs:complexType name="componentListingConfigured">
213233
<xs:complexContent>
214234
<xs:extension base="componentListing">
@@ -287,7 +307,7 @@
287307
</xs:annotation>
288308
<xs:complexType>
289309
<xs:choice minOccurs="1" maxOccurs="unbounded">
290-
<xs:group ref="formElements"/>
310+
<xs:group ref="formElementsConfig"/>
291311
</xs:choice>
292312
</xs:complexType>
293313
</xs:element>

app/code/Magento/Ui/view/base/ui_component/etc/definition/boolean.xsd

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<xs:element name="settings" minOccurs="0" maxOccurs="1">
1616
<xs:complexType>
1717
<xs:choice maxOccurs="unbounded" minOccurs="0">
18+
<xs:group ref="abstractSettings"/>
1819
<xs:group ref="componentBooleanSettings"/>
1920
</xs:choice>
2021
</xs:complexType>
@@ -23,9 +24,20 @@
2324
<xs:attributeGroup ref="ui_element_attributes"/>
2425
</xs:complexType>
2526

27+
<xs:complexType name="formElementBoolean">
28+
<xs:sequence>
29+
<xs:element name="settings" minOccurs="0" maxOccurs="1">
30+
<xs:complexType>
31+
<xs:choice maxOccurs="unbounded" minOccurs="0">
32+
<xs:group ref="componentBooleanSettings"/>
33+
</xs:choice>
34+
</xs:complexType>
35+
</xs:element>
36+
</xs:sequence>
37+
</xs:complexType>
38+
2639
<xs:group name="componentBooleanSettings">
2740
<xs:choice>
28-
<xs:group ref="abstractSettings"/>
2941
</xs:choice>
3042
</xs:group>
3143
</xs:schema>

app/code/Magento/Ui/view/base/ui_component/etc/definition/checkbox.xsd

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<xs:element name="settings" minOccurs="0" maxOccurs="1">
1616
<xs:complexType>
1717
<xs:choice minOccurs="0" maxOccurs="unbounded">
18+
<xs:group ref="abstractSettings"/>
1819
<xs:group ref="componentCheckboxSetting"/>
1920
</xs:choice>
2021
</xs:complexType>
@@ -23,9 +24,20 @@
2324
<xs:attributeGroup ref="ui_element_attributes"/>
2425
</xs:complexType>
2526

27+
<xs:complexType name="formElementCheckbox">
28+
<xs:sequence>
29+
<xs:element name="settings" minOccurs="0" maxOccurs="1">
30+
<xs:complexType>
31+
<xs:choice minOccurs="0" maxOccurs="unbounded">
32+
<xs:group ref="componentCheckboxSetting"/>
33+
</xs:choice>
34+
</xs:complexType>
35+
</xs:element>
36+
</xs:sequence>
37+
</xs:complexType>
38+
2639
<xs:group name="componentCheckboxSetting">
2740
<xs:choice>
28-
<xs:group ref="abstractSettings"/>
2941
<xs:element name="description" type="translatableString">
3042
<xs:annotation>
3143
<xs:documentation>

app/code/Magento/Ui/view/base/ui_component/etc/definition/checkboxset.xsd

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<xs:element name="settings" minOccurs="0" maxOccurs="1">
1616
<xs:complexType>
1717
<xs:choice maxOccurs="unbounded" minOccurs="0">
18+
<xs:group ref="abstractSettings"/>
1819
<xs:group ref="componentCheckboxsetSettings"/>
1920
</xs:choice>
2021
</xs:complexType>
@@ -23,9 +24,20 @@
2324
<xs:attributeGroup ref="ui_element_attributes"/>
2425
</xs:complexType>
2526

27+
<xs:complexType name="formElementCheckboxset">
28+
<xs:sequence>
29+
<xs:element name="settings" minOccurs="0" maxOccurs="1">
30+
<xs:complexType>
31+
<xs:choice maxOccurs="unbounded" minOccurs="0">
32+
<xs:group ref="componentCheckboxsetSettings"/>
33+
</xs:choice>
34+
</xs:complexType>
35+
</xs:element>
36+
</xs:sequence>
37+
</xs:complexType>
38+
2639
<xs:group name="componentCheckboxsetSettings">
2740
<xs:choice>
28-
<xs:group ref="abstractSettings"/>
2941
<xs:element ref="multiple"/>
3042
<xs:element name="options" type="optionsType"/>
3143
</xs:choice>

app/code/Magento/Ui/view/base/ui_component/etc/definition/date.xsd

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<xs:element name="settings" minOccurs="0" maxOccurs="1">
1616
<xs:complexType>
1717
<xs:choice minOccurs="0" maxOccurs="unbounded">
18+
<xs:group ref="abstractSettings"/>
1819
<xs:group ref="componentDateSettings"/>
1920
</xs:choice>
2021
</xs:complexType>
@@ -23,9 +24,20 @@
2324
<xs:attributeGroup ref="ui_element_attributes"/>
2425
</xs:complexType>
2526

27+
<xs:complexType name="formElementDate">
28+
<xs:sequence>
29+
<xs:element name="settings" minOccurs="0" maxOccurs="1">
30+
<xs:complexType>
31+
<xs:choice minOccurs="0" maxOccurs="unbounded">
32+
<xs:group ref="componentDateSettings"/>
33+
</xs:choice>
34+
</xs:complexType>
35+
</xs:element>
36+
</xs:sequence>
37+
</xs:complexType>
38+
2639
<xs:group name="componentDateSettings">
2740
<xs:choice>
28-
<xs:group ref="abstractSettings"/>
2941
<xs:element name="options" type="dateOptionsType">
3042
<xs:annotation>
3143
<xs:documentation>

app/code/Magento/Ui/view/base/ui_component/etc/definition/email.xsd

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<xs:element name="settings" minOccurs="0" maxOccurs="1">
1616
<xs:complexType>
1717
<xs:choice minOccurs="0" maxOccurs="unbounded">
18+
<xs:group ref="abstractSettings"/>
1819
<xs:group ref="componentEmailSettings"/>
1920
</xs:choice>
2021
</xs:complexType>
@@ -23,9 +24,20 @@
2324
<xs:attributeGroup ref="ui_element_attributes"/>
2425
</xs:complexType>
2526

27+
<xs:complexType name="formElementEmail">
28+
<xs:sequence>
29+
<xs:element name="settings" minOccurs="0" maxOccurs="1">
30+
<xs:complexType>
31+
<xs:choice minOccurs="0" maxOccurs="unbounded">
32+
<xs:group ref="componentEmailSettings"/>
33+
</xs:choice>
34+
</xs:complexType>
35+
</xs:element>
36+
</xs:sequence>
37+
</xs:complexType>
38+
2639
<xs:group name="componentEmailSettings">
2740
<xs:choice>
28-
<xs:group ref="abstractSettings"/>
2941
</xs:choice>
3042
</xs:group>
3143
</xs:schema>

app/code/Magento/Ui/view/base/ui_component/etc/definition/file.xsd

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<xs:element name="settings" minOccurs="0" maxOccurs="1">
1616
<xs:complexType>
1717
<xs:choice minOccurs="0" maxOccurs="unbounded">
18+
<xs:group ref="abstractSettings"/>
1819
<xs:group ref="componentFileSettings"/>
1920
</xs:choice>
2021
</xs:complexType>
@@ -23,9 +24,20 @@
2324
<xs:attributeGroup ref="ui_element_attributes"/>
2425
</xs:complexType>
2526

27+
<xs:complexType name="formElementFile">
28+
<xs:sequence>
29+
<xs:element name="settings" minOccurs="0" maxOccurs="1">
30+
<xs:complexType>
31+
<xs:choice minOccurs="0" maxOccurs="unbounded">
32+
<xs:group ref="componentFileSettings"/>
33+
</xs:choice>
34+
</xs:complexType>
35+
</xs:element>
36+
</xs:sequence>
37+
</xs:complexType>
38+
2639
<xs:group name="componentFileSettings">
2740
<xs:choice>
28-
<xs:group ref="abstractSettings"/>
2941
</xs:choice>
3042
</xs:group>
3143
</xs:schema>

app/code/Magento/Ui/view/base/ui_component/etc/definition/hidden.xsd

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<xs:element name="settings" minOccurs="0" maxOccurs="1">
1616
<xs:complexType>
1717
<xs:choice minOccurs="0" maxOccurs="unbounded">
18+
<xs:group ref="abstractSettings"/>
1819
<xs:group ref="hiddenSetting"/>
1920
</xs:choice>
2021
</xs:complexType>
@@ -23,9 +24,20 @@
2324
<xs:attributeGroup ref="ui_element_attributes"/>
2425
</xs:complexType>
2526

27+
<xs:complexType name="formElementHidden">
28+
<xs:sequence>
29+
<xs:element name="settings" minOccurs="0" maxOccurs="1">
30+
<xs:complexType>
31+
<xs:choice minOccurs="0" maxOccurs="unbounded">
32+
<xs:group ref="hiddenSetting"/>
33+
</xs:choice>
34+
</xs:complexType>
35+
</xs:element>
36+
</xs:sequence>
37+
</xs:complexType>
38+
2639
<xs:group name="hiddenSetting">
2740
<xs:choice>
28-
<xs:group ref="abstractSettings"/>
2941
</xs:choice>
3042
</xs:group>
3143
</xs:schema>

app/code/Magento/Ui/view/base/ui_component/etc/definition/input.xsd

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<xs:element name="settings" minOccurs="0" maxOccurs="1">
1616
<xs:complexType>
1717
<xs:choice minOccurs="0" maxOccurs="unbounded">
18+
<xs:group ref="abstractSettings" minOccurs="0"/>
1819
<xs:group ref="inputSetting"/>
1920
</xs:choice>
2021
</xs:complexType>
@@ -23,6 +24,17 @@
2324
<xs:attributeGroup ref="ui_element_attributes"/>
2425
</xs:complexType>
2526

27+
<xs:complexType name="formElementInput">
28+
<xs:sequence>
29+
<xs:element name="settings" minOccurs="0" maxOccurs="1">
30+
<xs:complexType>
31+
<xs:choice minOccurs="0" maxOccurs="unbounded">
32+
<xs:group ref="inputSetting"/>
33+
</xs:choice>
34+
</xs:complexType>
35+
</xs:element>
36+
</xs:sequence>
37+
</xs:complexType>
2638

2739
<xs:complexType name="componentRange">
2840
<xs:complexContent>
@@ -73,7 +85,6 @@
7385

7486
<xs:group name="inputSetting">
7587
<xs:choice>
76-
<xs:group ref="abstractSettings" minOccurs="0"/>
7788
</xs:choice>
7889
</xs:group>
7990
</xs:schema>

app/code/Magento/Ui/view/base/ui_component/etc/definition/multiselect.xsd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<xs:element name="settings" minOccurs="0" maxOccurs="1">
1616
<xs:complexType>
1717
<xs:choice minOccurs="0" maxOccurs="unbounded">
18+
<xs:group ref="abstractSettings"/>
1819
<xs:group ref="componentMultiselectSettings"/>
1920
</xs:choice>
2021
</xs:complexType>
@@ -23,6 +24,18 @@
2324
<xs:attributeGroup ref="ui_element_attributes"/>
2425
</xs:complexType>
2526

27+
<xs:complexType name="formElementMultiselect">
28+
<xs:sequence>
29+
<xs:element name="settings" minOccurs="0" maxOccurs="1">
30+
<xs:complexType>
31+
<xs:choice minOccurs="0" maxOccurs="unbounded">
32+
<xs:group ref="componentMultiselectSettings"/>
33+
</xs:choice>
34+
</xs:complexType>
35+
</xs:element>
36+
</xs:sequence>
37+
</xs:complexType>
38+
2639
<xs:group name="componentMultiselectSettings">
2740
<xs:choice>
2841
<xs:group ref="componentSelectSettings"/>

0 commit comments

Comments
 (0)