I don't like the idea of using XSD for YAML validation.
- First of all, it feels like magic and magic will bite you.
- Secondly there is a fundamental difference between xml and yaml/json
formats. That is xml nodes can have values and properties, whereas yaml/json
nodes are limited to properties only. This makes xml much more flexible and
expressive configuration language than anything else. And also breaks any
possibility of validation of property-only configurations, since it cannot
always be mapped directly to xml.
- Third reason is if we decide to go that route and use a common
validation, we limit ourselves to the capabilities of the most limited
configuration language, that is there (yaml), making the
xml confutations much more verbose and hard to read.
<service id="service_id" class="ServiceClass" />
now would become
<service>
<id>service_id</id>
<class>ServiceClass</class>
</service>
and even worse with xml routing files
- Last reason is the simple premise - use right tool for the job and XSD
is not right tool for validation of YAML
- in fact, there is no right tool, as YAML by definition
On Thu, Sep 30, 2010 at 12:07 PM, Jeremy Mikola <[email protected]> wrote:
> On Sep 29, 1:33 pm, Lukas Kahwe Smith <[email protected]> wrote:
> > On 29.09.2010, at 10:27, Francois Zaninotto wrote:
> >
> > then again it could just mean that someone could try to implement
> applying XSD validation directly on yaml aka interpreting the XSD rules and
> then checking the yaml if it passes. we might just support a subset of XSD
> for the time being which might cover most use cases already .. not sure ..
> just thinking allowed here.
>
> A co-worker of mine just suggested this while I was sharing an XSD a
> made for a bundle I'm working on. I think that's definitely do-able,
> and would make for a great Symfony2 console command. It wouldn't
> necessarily have to map back to a specific line in the YML, rather the
> XSD could validate the entire configuration once it is loaded by
> various drivers (XML, YML, PHP, annotations) and then report errors
> such as "validation: enabled expected boolean, string given".
>
> A side-benefit of this would be only requiring bundle developers to
> make a single file to serve multiple purposes, vs. additional schema/
> validation files in whatever format to validate YML, PHP, and other
> formats. Thought perhaps this is a mis-use of XSD?
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<symfony-devs%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en
>
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en