summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2013-05-21 07:45:50 -0400
committerJulian Berman <Julian@GrayVines.com>2013-05-21 07:51:31 -0400
commitf2781d6112e4cf6b7ad1234c8db208d55e551f59 (patch)
tree8157b9749a37033db03bf327fc0acbcfabef163b
parentd9a7c17244d518173e78665861270670dfcbb8f0 (diff)
downloadjsonschema-f2781d6112e4cf6b7ad1234c8db208d55e551f59.tar.gz
Add some clearer notes.
-rw-r--r--docs/creating.rst25
1 files changed, 22 insertions, 3 deletions
diff --git a/docs/creating.rst b/docs/creating.rst
index 87fcb09..6c42162 100644
--- a/docs/creating.rst
+++ b/docs/creating.rst
@@ -15,7 +15,7 @@ Creating or Extending Validators
:argument dict validators: a mapping from validator names to functions that
validate the given name. Each function should take 4 arguments: a
validator instance, the value of the current validator property in the
- instance being validated, the instance, and the schema.
+ instance being validated, the instance, and the schema.
:argument str version: an identifier for the version that this validator
will validate. If provided, the returned validator class will have its
@@ -37,13 +37,32 @@ Creating or Extending Validators
:argument jsonschema.IValidator validator: an existing validator
:argument dict validators: a set of new validators to add to the new
- validator. Any validators with the same name as an existing one will
- (silently) replace the old validator entirely.
+ validator.
+
+ .. note::
+
+ Any validators with the same name as an existing one will
+ (silently) replace the old validator entirely.
+
+ If you wish to extend an old validator, call it directly in the
+ replacing validator function by retrieving it using
+ ``OldValidator.VALIDATORS["the validator"]``.
:argument str version: a version for the new validator
:returns: an :class:`jsonschema.IValidator`
+ .. note:: Meta Schemas
+
+ The new validator will just keep the old validator's meta schema.
+
+ If you wish to change or extend the meta schema in the new validator,
+ modify ``META_SCHEMA`` directly on the returned class.
+
+ The meta schema on the new validator will not be a copy, so you'll
+ probably want to copy it before modifying it to not affect the old
+ validator.
+
.. autofunction:: validator_for