Release v2.3.0
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
v2.3.0
|
||||
------
|
||||
|
||||
* Added by_relevance and best_match (#91)
|
||||
* Fixed ``format`` to allow adding formats for non-strings (#125)
|
||||
* Fixed the ``uri`` format to reject URI references (#131)
|
||||
|
||||
v2.2.0
|
||||
------
|
||||
|
||||
|
||||
29
README.rst
29
README.rst
@@ -49,8 +49,33 @@ Features
|
||||
Release Notes
|
||||
-------------
|
||||
|
||||
``v2.2.0`` contains a minor speedup for the ``host-name`` format and a small
|
||||
change in draft 3's allowed types.
|
||||
``v2.3.0`` removes the (improper) limitation of ``format`` to strings. It also
|
||||
adds the `jsonschema.exceptions.best_match <https://python-jsonschema.readthedocs.org/en/latest/errors/#best-match-and-by-relevance>`_
|
||||
function which can be used to guess at the best matching single validation
|
||||
error for a given instance.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
>>> from jsonschema.validators import Draft4Validator
|
||||
>>> from jsonschema.exceptions import best_match
|
||||
|
||||
>>> schema = {
|
||||
... "properties" : {
|
||||
... "foo" : {"type" : "string"},
|
||||
... "bar" : {"properties" : {"baz": {"type": "string"}}},
|
||||
... },
|
||||
... }
|
||||
>>> instance = {"foo" : 12, "bar": {"baz" : 19}}
|
||||
>>> print(best_match(Draft4Validator(schema).iter_errors(instance)).path)
|
||||
deque(['foo'])
|
||||
|
||||
|
||||
where the error closer to the top of the instance in ``foo`` was selected
|
||||
as being more relevant.
|
||||
|
||||
Also, URI references are now properly rejected by the URI format validator
|
||||
(i.e., it now only accepts full URIs, as defined in the specification).
|
||||
|
||||
|
||||
Running the Test Suite
|
||||
|
||||
@@ -20,7 +20,7 @@ from jsonschema.validators import (
|
||||
)
|
||||
|
||||
|
||||
__version__ = "2.3.0-dev"
|
||||
__version__ = "2.3.0"
|
||||
|
||||
|
||||
# flake8: noqa
|
||||
|
||||
Reference in New Issue
Block a user