pykwalifire is a fork of the YAML/JSON validation library pykwalify. It adds the following features.
In order to be able to validate JSON or YAML files with non-default file extensions, the following two options have been introduced:
-y EXT, --yaml-extension EXT
to specify a custom extensionEXT
, allowing to validate YAML files such as my-yaml-file.yext.-j EXT, --json-extension EXT
to specify a custom extensionEXT
, allowing to validate JSON files such as my-json-file.jext.
pykwalifire drops support for Python 2.7. Python 2.x will not be maintained
past 2020, and its default ascii
encoding makes it a nightmare for unicode
support. To be able to use pykwalifire you must use it with Python 3.
As PyYAML, the most widely used YAML parser in the Python world, does not support YAML 1.2, ruamel.yaml is the default parser for pykwalifire.
Cf. pykwalify.
pykwalifire is available from PyPI: https://pypi.python.org/pypi/pykwalifire.
Install it with
pip install pykwalifire
Create a data file. JSON and YAML formats are both supported.
- foo
- bar
Create a schema file with validation rules.
type: seq
sequence:
- type: str
Validate the file from the command line:
pykwalifire -d data.yaml -s schema.yaml
If the YAML data file would be called data.customextension, you would validate it with
pykwalifire -d data.customextension -s schema.yaml -y customextension
For further documentation, please see the pykwalify documentation.
pykwalifire is licensed under the MIT license, cf. license file.
The pykwalify branch is used to create pull requests against the upstream repository. Hopefully this way all work that's been done in pykwalifire can be contributed back to the original project.
Thanks @Grokzen for creating a great piece of open source software!