File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ v2.3.0
2+ ------
3+
4+ * Added by_relevance and best_match (#91)
5+ * Fixed ``format `` to allow adding formats for non-strings (#125)
6+ * Fixed the ``uri `` format to reject URI references (#131)
7+
18v2.2.0
29------
310
Original file line number Diff line number Diff line change @@ -49,8 +49,33 @@ Features
4949Release Notes
5050-------------
5151
52- ``v2.2.0 `` contains a minor speedup for the ``host-name `` format and a small
53- change in draft 3's allowed types.
52+ ``v2.3.0 `` removes the (improper) limitation of ``format `` to strings. It also
53+ adds the `jsonschema.exceptions.best_match <https://python-jsonschema.readthedocs.org/en/latest/errors/#best-match-and-by-relevance >`_
54+ function which can be used to guess at the best matching single validation
55+ error for a given instance.
56+
57+
58+ .. code-block :: python
59+
60+ >> > from jsonschema.validators import Draft4Validator
61+ >> > from jsonschema.exceptions import best_match
62+
63+ >> > schema = {
64+ ... " properties" : {
65+ ... " foo" : {" type" : " string" },
66+ ... " bar" : {" properties" : {" baz" : {" type" : " string" }}},
67+ ... },
68+ ... }
69+ >> > instance = {" foo" : 12 , " bar" : {" baz" : 19 }}
70+ >> > print (best_match(Draft4Validator(schema).iter_errors(instance)).path)
71+ deque([' foo' ])
72+
73+
74+ where the error closer to the top of the instance in ``foo `` was selected
75+ as being more relevant.
76+
77+ Also, URI references are now properly rejected by the URI format validator
78+ (i.e., it now only accepts full URIs, as defined in the specification).
5479
5580
5681Running the Test Suite
Original file line number Diff line number Diff line change 2020)
2121
2222
23- __version__ = "2.3.0-dev "
23+ __version__ = "2.3.0"
2424
2525
2626# flake8: noqa
You can’t perform that action at this time.
0 commit comments