Skip to content

adding in examples and links #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 13, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/validate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ The simplest way to validate an instance under a given schema is to use the

.. autofunction:: validate

To learn more about creating json schema to validate your data, see
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I like this document, and I wouldn't mind linking to it as a resource for learning how to write JSON Schemas, but I'm not sure this is the best spot for it. I don't have a better suggestion though so I guess I can live with it. Or well, maybe as a lead-in to this document might work. Missing a plural here too for "schema" (and I think the rest of the docs generally capitalize like I did in this comment).

`Understanding JSON Schema <http://spacetelescope.github.io/understanding-json-schema/>`_

The Validator Interface
-----------------------

Expand Down Expand Up @@ -181,6 +184,26 @@ implements.

.. autoclass:: Draft4Validator

For example, if you wanted to validate a schema you created against the Draft 3
json schema, you could use:

.. code-block:: python


from jsonschema import Draft4Validator

schema = {
"$schema": "http://json-schema.org/schema#"

"type": "object",
"properties": {
"name": {"type": "string"},
"email": {"type": "string"},
}
"required": ["email"],
}
Draft4Validator.check_schema(schema)


Validating Formats
------------------
Expand Down