YAML Schema Validation?

Klaim picture Klaim · Feb 20, 2011 · Viewed 34.8k times · Source

Is there a schema validation language for YAML? I've googled but couldn't find anything useful.

Something like XSD format, using the language itself to describe the schema, would be the best choice in my case.

Answer

vossad01 picture vossad01 · Jun 30, 2017

JSON Schema can be used with most YAML documents resulting in a more portable and better documented solution than Rx or Kwalify. JSON Schema is the only of the three for which I have been able to find editor support.

More information on using YAML and JSON Schema including tools and editor support is tracked on this page. At the time of writing, there is editor support in Visual Studio Code and a command-line based validation tool available via npm.


Full Disclosure: I authored the web site linked above to try to make the application of JSON Schema to YAML more discoverable. I also wrote an editor extension for VS Code that has since been superseded by the RedHat extension linked above.