Tom Harris wrote:
> Greeting YAMListas
> As part of the integration test of our first YAML enabled product, I have a
> test step 'Validate that the contents of the log file are valid yml'. Now I
> have written a little script to perform this, but could there be scope for a
> web based validator, like the W3C have for XHTML? It could also warn about
> questionable stuff like presence of tabs. Is there really a need for
> validation, given that if the YAML parses, it is definitely valid? There
> could also be scope for enforcing rules, adherance to a schema, etc.
Brian Ingerson wrote something a little while back called WWYSH, which would let you enter YAML on a web page and have it validated. It wasn't really set up as a web service, per se, although it could easily be adapted to that purpose, I'm sure.
But I think the simpler answer to you question was the one you already gave--run the YAML against the parser of your choice, and the parser will point out where the YAML is invalid.
Perhaps you could tell us a little more about your project. For example, what programming language are using?
> On a similar note, seeing as one key niche for YAML is for configuration
> files, some people seem to *need* a GUI editor before they will even think
> of editing them. Do people think that a YAML editor is desirable? I was only
> able to move away from using hideous INI configuration files here (which
> could containe other INI files by base64'ing them!) to XML by the existence
> of a free XML editor.
We've talked about a YAML editor, but I don't if anybody is actively working on one.
Obviously, the need for a YAML editor depends on your audience. A relatively sophisticated user should just use a text editor that is configurable enough to run a command line utility, trap standard output, and go to a line number from the error output using a regex to detect the error. (Editplus, for example, would work on all counts.)
YAML is a text format, so any text editor suits it well for normal editing. A more customized YAML editor, though, could be a big win for large files. In particular, folding would be a nice feature to have, and it could be implemented without a full YAML parse.
One nice thing about YAML is that it maps directly to common data structures for languages like Perl, Python, and Ruby. So, if you can find a tool that lets you manipulate structured data, it's easy to get that data into YAML. For example, if you created a CGI application that manipulated lists and dictionaries of strings for a user, your users create configuration files without ever learning YAML. Of course, the data itself would be persisted in YAML, and you, the developer, would have the benefit of looking at the data in a concise, readable text format. We created a system like this at my last job in Perl, with the twist that all of our YAML data structures complied with XML schema definitions that had been ported to YAML.