diff options
author | Julian Berman <Julian@GrayVines.com> | 2013-05-21 07:45:50 -0400 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2013-05-21 07:51:31 -0400 |
commit | f2781d6112e4cf6b7ad1234c8db208d55e551f59 (patch) | |
tree | 8157b9749a37033db03bf327fc0acbcfabef163b /docs/creating.rst | |
parent | d9a7c17244d518173e78665861270670dfcbb8f0 (diff) | |
download | jsonschema-f2781d6112e4cf6b7ad1234c8db208d55e551f59.tar.gz |
Add some clearer notes.
Diffstat (limited to 'docs/creating.rst')
-rw-r--r-- | docs/creating.rst | 25 |
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 |