summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephen@that.guru>2022-06-16 15:50:04 +0100
committerStephen Finucane <stephenfinucane@hotmail.com>2022-06-16 19:32:21 +0200
commitda6c9201b182f00642f493a121578b69535c223b (patch)
tree2a07313910fb6bd6d91f0891dc8182e1b2339d40
parent51b7694c0fedabe6ffff354d0cab91ceec76fabc (diff)
downloadwarlock-da6c9201b182f00642f493a121578b69535c223b.tar.gz
Add support for jsonschema 4.x
jsonschema 4.0 was released in September 2021. It's time to support it. Only one issue to address in our tests, namely that when specifying the 'items' key for a property of type 'array', the value should be an object, not an array of objects. Good: { "type": "object", "properties": { "fruits": { "type": "array", "items": { "type": "string" } } } } Bad: { "type": "object", "properties": { "fruits": { "type": "array", "items": [{ "type": "string" }] } } } The docs say as much [1]. [1] https://json-schema.org/learn/miscellaneous-examples.html#arrays-of-things Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #64
-rw-r--r--poetry.lock15
-rw-r--r--pyproject.toml2
-rw-r--r--tests/test_core.py2
-rw-r--r--tox.ini3
4 files changed, 11 insertions, 11 deletions
diff --git a/poetry.lock b/poetry.lock
index 231094e..c1a92d4 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -72,7 +72,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "jsonschema"
-version = "3.2.0"
+version = "4.0.0"
description = "An implementation of JSON Schema validation for Python"
category = "main"
optional = false
@@ -81,12 +81,11 @@ python-versions = "*"
[package.dependencies]
attrs = ">=17.4.0"
importlib-metadata = {version = "*", markers = "python_version < \"3.8\""}
-pyrsistent = ">=0.14.0"
-six = ">=1.11.0"
+pyrsistent = ">=0.14.0,<0.17.0 || >0.17.0,<0.17.1 || >0.17.1,<0.17.2 || >0.17.2"
[package.extras]
-format = ["idna", "jsonpointer (>1.13)", "rfc3987", "strict-rfc3339", "webcolors"]
-format_nongpl = ["idna", "jsonpointer (>1.13)", "webcolors", "rfc3986-validator (>0.1.0)", "rfc3339-validator"]
+format = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3987", "uri-template", "webcolors (>=1.11)"]
+format_nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3986-validator (>0.1.0)", "uri-template", "webcolors (>=1.11)"]
[[package]]
name = "more-itertools"
@@ -232,7 +231,7 @@ testing = ["pathlib2", "contextlib2", "unittest2"]
[metadata]
lock-version = "1.1"
python-versions = "^3.5"
-content-hash = "163b233661736ad8b168e8c19509e93349e9f16b1be1012712114f3e1f447296"
+content-hash = "21e79f003cee0c519454cf16aaefcbff49f8d8c68d29290c0a1f4cb59f1fa8a8"
[metadata.files]
atomicwrites = [
@@ -294,8 +293,8 @@ jsonpointer = [
{file = "jsonpointer-2.0.tar.gz", hash = "sha256:c192ba86648e05fdae4f08a17ec25180a9aef5008d973407b581798a83975362"},
]
jsonschema = [
- {file = "jsonschema-3.2.0-py2.py3-none-any.whl", hash = "sha256:4e5b3cf8216f577bee9ce139cbe72eca3ea4f292ec60928ff24758ce626cd163"},
- {file = "jsonschema-3.2.0.tar.gz", hash = "sha256:c8a85b28d377cc7737e46e2d9f2b4f44ee3c0e1deac6bf46ddefc7187d30797a"},
+ {file = "jsonschema-4.0.0-py3-none-any.whl", hash = "sha256:c773028c649441ab980015b5b622f4cd5134cf563daaf0235ca4b73cc3734f20"},
+ {file = "jsonschema-4.0.0.tar.gz", hash = "sha256:bc51325b929171791c42ebc1c70b9713eb134d3bb8ebd5474c8b659b15be6d86"},
]
more-itertools = [
{file = "more-itertools-8.0.2.tar.gz", hash = "sha256:b84b238cce0d9adad5ed87e745778d20a3f8487d0f0cb8b8a586816c7496458d"},
diff --git a/pyproject.toml b/pyproject.toml
index db3e6ec..1e7479b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -29,7 +29,7 @@ packages = [
[tool.poetry.dependencies]
python = "^3.5"
-jsonschema = "^3"
+jsonschema = "^4"
jsonpatch = "^1"
[tool.poetry.dev-dependencies]
diff --git a/tests/test_core.py b/tests/test_core.py
index bc36c92..390e61c 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -38,7 +38,7 @@ parent_fixture = {
"name": "Parent",
"properties": {
"name": {"type": "string"},
- "children": {"type": "array", "items": [{"type": "object"}]},
+ "children": {"type": "array", "items": {"type": "object"}},
},
"required": ["name", "children"],
}
diff --git a/tox.ini b/tox.ini
index 928be3b..f38885d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,8 +3,9 @@ skipsdist = True
envlist = py35,py36,py37,py38
[testenv]
-whitelist_externals = poetry
skip_install = true
+deps =
+ poetry
commands =
poetry install -v
poetry run pytest