diff options
author | Julian Berman <Julian+git@GrayVines.com> | 2012-01-15 20:08:03 -0500 |
---|---|---|
committer | Julian Berman <Julian+git@GrayVines.com> | 2012-01-15 20:08:03 -0500 |
commit | 0500c5069db7e997bb71cdab497e6b8e8a17d5b2 (patch) | |
tree | 90fc12dfd01598565a6e73a8a7dc580b956cc3b4 | |
parent | c54d30f61e3dea2f5fd7b6eb9ace8ee2c0662a0b (diff) | |
download | jsonschema-0500c5069db7e997bb71cdab497e6b8e8a17d5b2.tar.gz |
Docstring
-rw-r--r-- | jsonschema.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/jsonschema.py b/jsonschema.py index 6932008..2c3b3db 100644 --- a/jsonschema.py +++ b/jsonschema.py @@ -82,6 +82,27 @@ class Validator(object): unknown_property="error", string_types=basestring, number_types=(int, float) ): + """ + Initialize a Validator. + + If ``stop_on_error`` is ``True`` (default), immediately stop validation + when an error occurs. Otherwise, wait until validation is completed, + then display all validation errors at once. + + ``unknown_type`` and ``unknown_property`` control what to do when an + unknown type (resp. property) is encountered. By default an error is + raised (``"error"``). Other valid inputs are ``"warn"``, raising a + warning, and ``"skip"`` to ignore. + + ``string_types`` and ``number_types`` control which Python types are + considered to be JSON ``String``s and ``Number``s respectively. By + default, ``basestring`` (which means, ``str`` + ``unicode``) is used + for ``string_types``, and ``int`` and ``float`` are the number_types. + To override this behavior (e.g. for ``decimal.Decimal``), provide a + type or tuple of types to use (*including* the default types if so + desired). + + """ self.stop_on_error = stop_on_error self._unknown_type = unknown_type |