diff options
author | Johan Fleury <jfleury@arcaik.net> | 2018-10-08 12:58:12 -0400 |
---|---|---|
committer | Johan Fleury <jfleury@arcaik.net> | 2018-10-08 12:58:12 -0400 |
commit | 735c78d3ecb695dd16cb37879880f522c4b29c72 (patch) | |
tree | 8bfb2ecbd0f03730efa1540cc65d8490b67e8ddd /docs/basics.rst |
Import upstream version 1.7.0
Diffstat (limited to 'docs/basics.rst')
-rw-r--r-- | docs/basics.rst | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/basics.rst b/docs/basics.rst new file mode 100644 index 0000000..b2bd878 --- /dev/null +++ b/docs/basics.rst @@ -0,0 +1,35 @@ +Basic Usage +=========== + +Create a data ``json`` or ``yaml`` file. + +.. code-block:: yaml + + # Data file (data.yaml) + - foo + - bar + +Create a schema file with validation rules. + +.. code-block:: yaml + + # Schema file (schema.yaml) + type: seq + sequence: + - type: str + +Run validation from cli. + +.. code-block:: bash + + pykwalify -d data.yaml -s schema.yaml + +Or if you want to run the validation from inside your code directly. + +.. code-block:: python + + from pykwalify.core import Core + c = Core(source_file="data.yaml", schema_files=["schema.yaml"]) + c.validate(raise_exception=True) + +If validation fails then exception will be raised. |