Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.3 Development: Clarify XSD for formElements allowed settings #15161

Merged
merged 7 commits into from
May 17, 2018
Merged

2.3 Development: Clarify XSD for formElements allowed settings #15161

merged 7 commits into from
May 17, 2018

Conversation

neillrobson
Copy link
Contributor

Description

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.

Fixed Issues (if relevant)

  1. UI component definition.map.xml overlooks XSD-valid nodes #14140: UI component definition.map.xml overlooks XSD-valid nodes

Note: This pull request contains the same code changes and functionality from PR 14170, but this PR affects the 2.3-develop branch rather than the old 2.2-develop branch.

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.
I did a bit of code digging but couldn't figure out why the price
component definition did not have any valid/configured child nodes for
<settings> whatsoever. I decided that the best route would be to add
blank groups with the proper labels, so that the actual validation
results remain unchanged, but the skeleton now exists for future
developers to add valid configuration.
I'm not sure if the solution proposed in this commit is correct, but I
couldn't figure out any more logical way to deal with the validation
errors on the Travis CI build. The error follows:

1) Magento\Test\Integrity\Xml\SchemaTest::testXmlFiles Passed: 1881,
Failed: 6, Incomplete: 0, Skipped: 0.  Data set:
/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml
Error validating
/home/travis/build/magento/magento2/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml
against urn:magento:module:Magento_Ui:etc/ui_configuration.xsd
Array (
[0] => Element 'fileUploader': This element is not expected. Expected is
one of ( hidden, file, input, date, boolean, checkbox, checkboxset,
email, select, multiselect ).  Line: 168
[1] => Element 'wysiwyg',
attribute 'class': The attribute 'class' is not allowed.  Line: 206
)
Failed asserting that an array is empty.

Element zero in that array is what I am attempting to fix here.
Without this part of the configuration, children of <formElements> nodes
can not have their attributes (such as "class") configured.
Again, this error was discovered during the Travis CI build,
specifically during validation of
/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml,
line 275.
@VladimirZaets
Copy link
Contributor

Hi, @RNanoware, thank you for collaboration. I will close PR to 2.2-develop.

@VladimirZaets
Copy link
Contributor

Hi @RNanoware. Looks like in Magento 2.3 we add imageUploader as new formElement type.
Please add imageUploader to XSD, thanks.

@VladimirZaets
Copy link
Contributor

@RNanoware thanks!

@magento-engcom-team
Copy link
Contributor

Hi @RNanoware. Thank you for your contribution.
Changes from your Pull Request will be available with the upcoming 2.3.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI component definition.map.xml overlooks XSD-valid nodes
3 participants