One of the benefits of XML is being able to validate a document against an XSD. YAML doesn\'t have this feature, so how can I validate that the YAML document I open is in th
I wrapped some existing json-related python libraries aiming for being able to use them with yaml as well.
The resulting python library mainly wraps ...
jsonschema - a validator for json files against json-schema files, being wrapped to support validating yaml files against json-schema files in yaml-format as well.
jsonpath-ng - an implementation of JSONPath for python, being wrapped to support JSONPath selection directly on yaml files.
... and is available on github:
https://github.com/yaccob/ytools
It can be installed using pip:
pip install ytools
Validation example (from https://github.com/yaccob/ytools#validation):
import ytools
ytools.validate("test/sampleschema.yaml", ["test/sampledata.yaml"])
What you don't get out of the box yet, is validating against external schemas that are in yaml format as well.
ytools is not providing anything that hasn't existed before - it just makes the application of some existing solutions more flexible and more convenient.