summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2017-12-24 15:04:01 -0500
committerJulian Berman <Julian@GrayVines.com>2017-12-24 15:04:01 -0500
commitec20e7b570ed662c29c16d6d99f17243919d6d73 (patch)
treedadf3bf816c762f878b3b9e2c0d170520a5a4708
parentba52a016fe28d39c4d97ce8ce5104ee43eeaf695 (diff)
downloadjsonschema-ec20e7b570ed662c29c16d6d99f17243919d6d73.tar.gz
:attr:
-rw-r--r--docs/errors.rst44
-rw-r--r--docs/validate.rst10
2 files changed, 27 insertions, 27 deletions
diff --git a/docs/errors.rst b/docs/errors.rst
index 4bd0e3b..60e5a7d 100644
--- a/docs/errors.rst
+++ b/docs/errors.rst
@@ -60,11 +60,11 @@ raised or returned, depending on which method or function is used.
A `collections.deque` containing the path to the failed
validator within the schema, but always relative to the
*original* schema as opposed to any subschema (i.e. the one
- originally passed into a validator class, *not* :attr:`schema`\).
+ originally passed into a validator class, *not* `schema`\).
.. attribute:: schema_path
- Same as :attr:`relative_schema_path`.
+ Same as `relative_schema_path`.
.. attribute:: relative_path
@@ -78,12 +78,12 @@ raised or returned, depending on which method or function is used.
offending element within the instance. The absolute path
is always relative to the *original* instance that was
validated (i.e. the one passed into a validation method, *not*
- :attr:`instance`\). The deque can be empty if the error happened
+ `instance`\). The deque can be empty if the error happened
at the root of the instance.
.. attribute:: path
- Same as :attr:`relative_path`.
+ Same as `relative_path`.
.. attribute:: instance
@@ -91,14 +91,14 @@ raised or returned, depending on which method or function is used.
the instance originally passed into ``validate`` if the
validator object was in the process of validating a (possibly
nested) element within the top-level instance. The path within
- the top-level instance (i.e. :attr:`ValidationError.path`) could
+ the top-level instance (i.e. `ValidationError.path`) could
be used to find this object, but it is provided for convenience.
.. attribute:: context
If the error was caused by errors in subschemas, the list of errors
from the subschemas will be available on this property. The
- :attr:`.schema_path` and :attr:`.path` of these errors will be relative
+ `schema_path` and `path` of these errors will be relative
to the parent error.
.. attribute:: cause
@@ -110,7 +110,7 @@ raised or returned, depending on which method or function is used.
.. attribute:: parent
- A validation error which this error is the :attr:`context` of.
+ A validation error which this error is the `context` of.
``None`` if there wasn't one.
@@ -155,9 +155,9 @@ outputs:
3 is not valid under any of the given schemas
'foo' is not valid under any of the given schemas
-If we look at :attr:`~ValidationError.path` on each of the errors, we can find
+If we look at `ValidationError.path` on each of the errors, we can find
out which elements in the instance correspond to each of the errors. In
-this example, :attr:`~ValidationError.path` will have only one element, which
+this example, `ValidationError.path` will have only one element, which
will be the index in our list.
.. testcode::
@@ -173,16 +173,16 @@ will be the index in our list.
Since our schema contained nested subschemas, it can be helpful to look at
the specific part of the instance and subschema that caused each of the errors.
-This can be seen with the :attr:`~ValidationError.instance` and
-:attr:`~ValidationError.schema` attributes.
+This can be seen with the `ValidationError.instance` and
+`ValidationError.schema` attributes.
-With validators like :validator:`anyOf`, the :attr:`~ValidationError.context`
+With validators like :validator:`anyOf`, the `ValidationError.context`
attribute can be used to see the sub-errors which caused the failure. Since
these errors actually came from two separate subschemas, it can be helpful to
-look at the :attr:`~ValidationError.schema_path` attribute as well to see where
+look at the `ValidationError.schema_path` attribute as well to see where
exactly in the schema each of these errors come from. In the case of sub-errors
-from the :attr:`~ValidationError.context` attribute, this path will be relative
-to the :attr:`~ValidationError.schema_path` of the parent error.
+from the `ValidationError.context` attribute, this path will be relative
+to the `ValidationError.schema_path` of the parent error.
.. testcode::
@@ -272,7 +272,7 @@ error objects.
As you can see, `jsonschema.exceptions.ErrorTree` takes an
iterable of `ValidationError`\s when constructing a tree so
you can directly pass it the return value of a validator object's
-:attr:`~jsonschema.IValidator.iter_errors` method.
+`jsonschema.IValidator.iter_errors` method.
`ErrorTree`\s support a number of useful operations. The first one we
might want to perform is to check whether a given element in our instance
@@ -291,7 +291,7 @@ did have an error (in fact it had 2), while the 1th index (``2``) did not (i.e.
it was valid).
If we want to see which errors a child had, we index into the tree and look at
-the :attr:`~ErrorTree.errors` attribute.
+the `ErrorTree.errors` attribute.
.. doctest::
@@ -299,7 +299,7 @@ the :attr:`~ErrorTree.errors` attribute.
['enum', 'type']
Here we see that the :validator:`enum` and :validator:`type` validators failed
-for index ``0``. In fact :attr:`~ErrorTree.errors` is a dict, whose values are
+for index ``0``. In fact `ErrorTree.errors` is a dict, whose values are
the `ValidationError`\s, so we can get at those directly if we want
them.
@@ -310,7 +310,7 @@ them.
Of course this means that if we want to know if a given named
validator failed for a given index, we check for its presence in
-:attr:`~ErrorTree.errors`:
+`ErrorTree.errors`:
.. doctest::
@@ -334,7 +334,7 @@ That's all you need to know to use error trees.
To summarize, each tree contains child trees that can be accessed by
indexing the tree to get the corresponding child tree for a given index
-into the instance. Each tree and child has a :attr:`~ErrorTree.errors`
+into the instance. Each tree and child has a `ErrorTree.errors`
attribute, a dict, that maps the failed validator name to the
corresponding validation error.
@@ -363,7 +363,7 @@ to guess the most relevant error in a given bunch.
Try to find an error that appears to be the best match among given errors.
In general, errors that are higher up in the instance (i.e. for which
- :attr:`ValidationError.path` is shorter) are considered better matches,
+ `ValidationError.path` is shorter) are considered better matches,
since they indicate "more" is wrong with the instance.
If the resulting match is either :validator:`oneOf` or :validator:`anyOf`,
@@ -376,7 +376,7 @@ to guess the most relevant error in a given bunch.
(i.e. from different instances or schemas), since it won't
produce sensical output.
:argument callable key: the key to use when sorting errors. See
- :attr:`relevance` and transitively :func:`by_relevance` for more
+ `relevance` and transitively :func:`by_relevance` for more
details (the default is to sort with the defaults of that function).
Changing the default is only useful if you want to change the function
that rates errors but still want the error context descent done by
diff --git a/docs/validate.rst b/docs/validate.rst
index 398fdd9..707bb7e 100644
--- a/docs/validate.rst
+++ b/docs/validate.rst
@@ -82,7 +82,7 @@ classes should adhere to.
.. classmethod:: check_schema(schema)
- Validate the given schema against the validator's :attr:`META_SCHEMA`.
+ Validate the given schema against the validator's `META_SCHEMA`.
:raises: :exc:`jsonschema.exceptions.SchemaError` if the schema
is invalid
@@ -98,7 +98,7 @@ classes should adhere to.
.. method:: is_valid(instance)
- Check if the instance is valid under the current :attr:`schema`.
+ Check if the instance is valid under the current `schema`.
:rtype: bool
@@ -126,7 +126,7 @@ classes should adhere to.
.. method:: validate(instance)
- Check if the instance is valid under the current :attr:`schema`.
+ Check if the instance is valid under the current `schema`.
:raises: :exc:`jsonschema.exceptions.ValidationError` if the
instance is invalid
@@ -284,14 +284,14 @@ validation can be enabled by hooking in a format-checking object into an
:argument Exception raises: the exception(s) raised
by the decorated function when an invalid instance is
found. The exception object will be accessible as the
- :attr:`~jsonschema.exceptions.ValidationError.cause` attribute
+ `jsonschema.exceptions.ValidationError.cause` attribute
of the resulting validation error.
There are a number of default checkers that `FormatChecker`\s know how
to validate. Their names can be viewed by inspecting the
-:attr:`FormatChecker.checkers` attribute. Certain checkers will only be
+`FormatChecker.checkers` attribute. Certain checkers will only be
available if an appropriate package is available for use. The available
checkers, along with their requirement (if any,) are listed below.