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

Eliminate XSD relative paths #1012

Closed
alankent opened this issue Jan 30, 2015 · 3 comments
Closed

Eliminate XSD relative paths #1012

alankent opened this issue Jan 30, 2015 · 3 comments

Comments

@alankent
Copy link

Currently XSD path references are file paths using ../../.. notation. This is not desirable. Relative paths impose physical file location constraints on your component, as well as for the component where the XML-schema resides. It denies flexibility of how you can deploy your component. There is also a separate plan to make it easier to locate modules in places other than under app/code (e.g. under 'vendor' as well), in which case the physical location of the XSD file cannot be guaranteed.

The plan is to move to absolute paths (possibly a URN) that the code knows how to resolve to a XSD on the file system. An approach based on just the filename (such as "layout.xsd") may also be possible.

Some have proposed it be a URL where the file is hosted publicly somewhere such as GitHub. This is not proposed. Instead it is proposed that developers are required to configure their development environment to map the XSD references to physical file locations.

Stage 1 of this work would be to propose a strategy friendly with the PHP code in developer mode using XSD files to validate XML files. This should be reviewed and signed off by the Magento team before implementation (to avoid wasted effort).

Stage 2 would be to implement the changes required.

For example, any module can introduce a new XSD for its own configuration that another module may then want to replace/extend. For example, one approach is to use something like urn:magento:xsd:Vendor:Module:v1.0:layout.xsd so the vendor/module name is in the path. Then the XSD reference is relative to the home directory of a module, wherever it is. The XML parsing library would need to be extended to map this form of schema reference to the actual filename of the XSD file.

Consideration should also be give to tools like PHP Storm and how easy it will be to configure them. Can PHP Storm import the equivalent of a SGML CATALOG file for mapping URIs to physical file locations?

@TexanHogman
Copy link

internal ticket MAGETWO-33621 and related comment.

There is no perfect solution here. We could host but questions arise on versioning, support for community schemas and this creates unnecessary complexities at this time. We could change to a URN but then action is required for every XSD in PHPStorm. We would also need to add support for the URN based resolution for our static tests. The relative path works for code within the app/code and we suspect that is how development of an extension will typically start. This is when validation against the XSD is most critical. When an extension is hosted in a separate repo, versioned and published independently the relative path is a problem but the user can configure PHPStorm to map to the schema in the project and validation can occur. In light of these details, I recommend no action at this time.

@JamesAnelay
Copy link
Contributor

Done now I belive? Just adding this note so it can be closed.

@davidalger
Copy link
Member

Yes, this was done before merchant beta dropped. Also there is a command in the CLI tool to generate the meta data PHPStorm needs to follow the URNs.

magento-team pushed a commit that referenced this issue Apr 14, 2017
[Epam] Extend functional test sprint 8

- MTO-103: [Variation] Auto-complete Search Terms and Phrases while User is Typing
- MTO-114: [Variation] Low Stock Products Report
- MTO-131: [Constraint] Check invoiced order on Admin Dashboard
- MTO-145: [Constraint] Check order grid date filter
magento-team pushed a commit that referenced this issue Dec 13, 2017
… attributes. #1012

 - Merge Pull Request magento-engcom/magento2ce#1012 from nmalevanec/magento2:10814
 - Merged commits:
   1. 3747258
   2. d29548f
magento-team pushed a commit that referenced this issue Dec 13, 2017
Merge pull request #1014 from magento-engcom/2.2-develop-prs

[EngCom] Public Pull Requests - 2.2-develop

Public Pull Requests
 - #1012 10814: Attribute repository resets sourceModel for new attributes. by @nmalevanec
- #1006 #12285: The option false for mobile device don't work in product -
view page gallery by @p-bystritsky
- #983 #12259: Save and Duplicated product not working by @p-bystritsky
- #1000 8204: catalog:images:resize = getimagesize(): Read error! by @RomaKis
#12633 Magento Connect no longer exist by @miguelbalparda

Fixed Public Issues
 - #10814 Attribute repository resets sourceModel for new attributes
 - #12285 The option false for mobile device don't work in product view page gallery
 - #12490 I can't disable full screen gallery on mobile on magento 2.2.1
 - #12259 Save and Duplicated product not working
 - #8204 catalog:images:resize = getimagesize(): Read error! in vendor/magento/module-catalog/Model/Product/Image.php on line 410 if an image is 0 bytes
 - #12632 Magento Connect no longer exist
VitaliyBoyko pushed a commit to VitaliyBoyko/magento2 that referenced this issue Jun 22, 2018
MSI-1011: Implement IsCorrectQtyConditionTest::testExecuteWithUseConfigQtyIncrements
magento-engcom-team added a commit that referenced this issue Oct 23, 2019
…ent_id description #1012

 - Merge Pull Request magento/graphql-ce#1012 from magento/graphql-ce:editorial-customerOrders
 - Merged commits:
   1. a8ef3e1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants