summaryrefslogtreecommitdiff
path: root/docs/basics.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/basics.rst')
-rw-r--r--docs/basics.rst35
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.