Skip to content

Commit f9b1e32

Browse files
committed
adding in examples and links
* Adding in an example of using the schema validator * Adding in a link to 'Understanding JSON Schema' at http://spacetelescope.github.io/understanding-json-schema/
1 parent 1ca7d21 commit f9b1e32

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/validate.rst

Lines changed: 14 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,16 @@ 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 Draft3Validator
194+
my_schema = json.loads(my_schema_file)
195+
Draft3Validator.check_schema(schema)
196+
184197
185198
Validating Formats
186199
------------------
@@ -260,3 +273,4 @@ color requires webcolors_
260273
.. _rfc3987: http://pypi.python.org/pypi/rfc3987/
261274
.. _strict-rfc3339: http://pypi.python.org/pypi/strict-rfc3339/
262275
.. _webcolors: http://pypi.python.org/pypi/webcolors/
276+
.. _understanding_json_schema: http://spacetelescope.github.io/understanding-json-schema/

0 commit comments

Comments
 (0)