@@ -36,29 +36,29 @@ raised or returned, depending on which method or function is used.
3636
3737 .. attribute:: validator
3838
39- The name of the failed `validator
39+ The name of the failed `keyword
4040 <https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-structural> `_.
4141
4242 .. attribute:: validator_value
4343
44- The value for the failed validator in the schema.
44+ The associated value for the failed keyword in the schema.
4545
4646 .. attribute:: schema
4747
4848 The full schema that this error came from. This is potentially a
4949 subschema from within the schema that was passed in originally,
50- or even an entirely different schema if a :validator : `$ref ` was
50+ or even an entirely different schema if a :kw : `$ref ` was
5151 followed.
5252
5353 .. attribute:: relative_schema_path
5454
55- A `collections.deque ` containing the path to the failed
56- validator within the schema.
55+ A `collections.deque ` containing the path to the failed keyword
56+ within the schema.
5757
5858 .. attribute:: absolute_schema_path
5959
6060 A `collections.deque ` containing the path to the failed
61- validator within the schema, but always relative to the
61+ keyword within the schema, but always relative to the
6262 *original * schema as opposed to any subschema (i.e. the one
6363 originally passed into a validator class, *not * `schema `\) .
6464
@@ -179,7 +179,7 @@ the specific part of the instance and subschema that caused each of the errors.
179179This can be seen with the `ValidationError.instance ` and
180180`ValidationError.schema ` attributes.
181181
182- With validators like :validator : `anyOf `, the `ValidationError.context `
182+ With keywords like :kw : `anyOf `, the `ValidationError.context `
183183attribute can be used to see the sub-errors which caused the failure. Since
184184these errors actually came from two separate subschemas, it can be helpful to
185185look at the `ValidationError.schema_path ` attribute as well to see where
@@ -224,8 +224,8 @@ easier debugging.
224224ErrorTrees
225225----------
226226
227- If you want to programmatically be able to query which properties or validators
228- failed when validating a given instance, you probably will want to do so using
227+ If you want to programmatically query which validation keywords
228+ failed when validating a given instance, you may want to do so using
229229`jsonschema.exceptions.ErrorTree ` objects.
230230
231231.. autoclass:: jsonschema.exceptions.ErrorTree
@@ -235,7 +235,7 @@ failed when validating a given instance, you probably will want to do so using
235235
236236 .. attribute:: errors
237237
238- The mapping of validator names to the error objects (usually
238+ The mapping of validator keywords to the error objects (usually
239239 `jsonschema.exceptions.ValidationError `\s ) at this level
240240 of the tree.
241241
@@ -301,18 +301,17 @@ the `ErrorTree.errors` attribute.
301301 >>> sorted(tree[0].errors)
302302 ['enum', 'type']
303303
304- Here we see that the :validator: `enum ` and :validator: `type ` validators failed
305- for index ``0 ``. In fact `ErrorTree.errors ` is a dict, whose values are
306- the `ValidationError `\s , so we can get at those directly if we want
307- them.
304+ Here we see that the :kw: `enum ` and :kw: `type ` keywords failed for
305+ index ``0 ``. In fact `ErrorTree.errors ` is a dict, whose values are the
306+ `ValidationError `\s , so we can get at those directly if we want them.
308307
309308.. doctest::
310309
311310 >>> print(tree[0].errors["type"].message)
312311 'spam' is not of type 'number'
313312
314- Of course this means that if we want to know if a given named
315- validator failed for a given index, we check for its presence in
313+ Of course this means that if we want to know if a given validation
314+ keyword failed for a given index, we check for its presence in
316315`ErrorTree.errors `:
317316
318317.. doctest::
@@ -323,9 +322,9 @@ validator failed for a given index, we check for its presence in
323322 >>> "minimum" in tree[0].errors
324323 False
325324
326- Finally, if you were paying close enough attention, you'll notice that we
327- haven't seen our :validator : `minItems ` error appear anywhere yet. This is
328- because :validator : `minItems ` is an error that applies globally to the instance
325+ Finally, if you were paying close enough attention, you'll notice that
326+ we haven't seen our :kw : `minItems ` error appear anywhere yet. This is
327+ because :kw : `minItems ` is an error that applies globally to the instance
329328itself. So it appears in the root node of the tree.
330329
331330.. doctest::
@@ -336,9 +335,9 @@ itself. So it appears in the root node of the tree.
336335That's all you need to know to use error trees.
337336
338337To summarize, each tree contains child trees that can be accessed by
339- indexing the tree to get the corresponding child tree for a given index
340- into the instance. Each tree and child has a `ErrorTree.errors `
341- attribute, a dict, that maps the failed validator name to the
338+ indexing the tree to get the corresponding child tree for a given
339+ index into the instance. Each tree and child has a `ErrorTree.errors `
340+ attribute, a dict, that maps the failed validation keyword to the
342341corresponding validation error.
343342
344343
@@ -373,14 +372,14 @@ to guess the most relevant error in a given bunch.
373372 `sorted ` or `max ` will cause more relevant errors to be
374373 considered greater than less relevant ones.
375374
376- Within the different validators that can fail, this function
377- considers :validator : `anyOf ` and :validator : `oneOf ` to be *weak *
378- validation errors, and will sort them lower than other validators at
379- the same level in the instance.
375+ Within the different validation keywords that can fail, this
376+ function considers :kw : `anyOf ` and :kw : `oneOf ` to be *weak *
377+ validation errors, and will sort them lower than other errors at the
378+ same level in the instance.
380379
381- If you want to change the set of weak [or strong] validators you can create
382- a custom version of this function with ` by_relevance ` and provide a
383- different set of each.
380+ If you want to change the set of weak [or strong] validation
381+ keywords you can create a custom version of this function with
382+ ` by_relevance ` and provide a different set of each.
384383
385384.. doctest::
386385
0 commit comments