Skip to content

Commit 85aa2ab

Browse files
committed
Merge remote-tracking branch 'heckj/patch-1'
* heckj/patch-1: updating per feedback adding in examples and links
2 parents ef3e419 + ac0dee4 commit 85aa2ab

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/validate.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ The simplest way to validate an instance under a given schema is to use the
1414

1515
.. autofunction:: validate
1616

17+
To learn more about creating json schema to validate your data, see
18+
`Understanding JSON Schema <http://spacetelescope.github.io/understanding-json-schema/>`_
19+
1720
The Validator Interface
1821
-----------------------
1922

@@ -181,6 +184,26 @@ implements.
181184

182185
.. autoclass:: Draft4Validator
183186

187+
For example, if you wanted to validate a schema you created against the Draft 3
188+
json schema, you could use:
189+
190+
.. code-block:: python
191+
192+
193+
from jsonschema import Draft4Validator
194+
195+
schema = {
196+
"$schema": "http://json-schema.org/schema#"
197+
198+
"type": "object",
199+
"properties": {
200+
"name": {"type": "string"},
201+
"email": {"type": "string"},
202+
}
203+
"required": ["email"],
204+
}
205+
Draft4Validator.check_schema(schema)
206+
184207
185208
Validating Formats
186209
------------------

0 commit comments

Comments
 (0)