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

XSD schema for XML mapping #1334

Merged
merged 2 commits into from
Dec 10, 2022
Merged

XSD schema for XML mapping #1334

merged 2 commits into from
Dec 10, 2022

Conversation

yivi
Copy link
Contributor

@yivi yivi commented Nov 22, 2022

Provides an XSD schema so that creating XML mapping is easier, since IDE can use it for autocompletion

Improvement

Q A
New Feature yes
RFC yes
BC Break no

Summary

Creating an XML document without an associated XSD schema is error prone. With the provided XSD schema, IDEs can provide autocompletion, and XML files can be validated.

@yivi
Copy link
Contributor Author

yivi commented Nov 22, 2022

Excuse the clumsiness while typing on the recording, but here is an example of autocomplete using the XSD schema on PhpStorm: https://share.cleanshot.com/wrDBOU

vich_uploader.xsd Show resolved Hide resolved
@garak
Copy link
Collaborator

garak commented Dec 4, 2022

Just another little doubt: should we update the docs as well?

@yivi
Copy link
Contributor Author

yivi commented Dec 9, 2022

sorry, I was out on holidays.

I'll update the XML in the docs as well, so users know they can benefit from the schema.

show schema in use
@@ -6,7 +6,8 @@ format and comes with the following syntax to declare your uploadable fields:
```xml
<!-- config/vich_uploader/Entity.Product.xml -->
<!-- Attributes "mapping", "name" and "filename_property" are required -->
<vich_uploader class="Acme\DemoBundle\Entity\Product">
<vich_uploader xmlns="https://vich-uploader-bundle/schema/"
Copy link
Collaborator

@garak garak Dec 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I know that the "xmlns" attribute is not required to be a reachable URL, but I'm wondering how can the IDE understand where it's located (and so providing autocompletion). Could you clarify that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least on phpstorm, if the file is within the project directories it will be picked up automatically.

@garak garak merged commit b4734d9 into dustin10:master Dec 10, 2022
@garak
Copy link
Collaborator

garak commented Dec 10, 2022

Thank you @yivi

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.

None yet

2 participants