Skip to content

Commit 9f07f01

Browse files
authored
Merge pull request #38 from p1c2u/revert/jsonschema-dependency-reintroduced
make jsonschema4 compatible (DeprecationWarning fix) reintroduced
2 parents 97970e2 + 4d76c99 commit 9f07f01

File tree

3 files changed

+55
-56
lines changed

3 files changed

+55
-56
lines changed

Diff for: openapi_schema_validator/validators.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from attr import attrib, attrs
12
from copy import deepcopy
23

34
from jsonschema import _legacy_validators, _utils, _validators
@@ -71,12 +72,11 @@
7172
)
7273

7374

75+
@attrs
7476
class OAS30Validator(BaseOAS30Validator):
7577

76-
def __init__(self, *args, **kwargs):
77-
self.read = kwargs.pop('read', None)
78-
self.write = kwargs.pop('write', None)
79-
super(OAS30Validator, self).__init__(*args, **kwargs)
78+
read: bool = attrib(default=None)
79+
write: bool = attrib(default=None)
8080

8181
def iter_errors(self, instance, _schema=None):
8282
if _schema is None:
@@ -89,7 +89,8 @@ def iter_errors(self, instance, _schema=None):
8989
'nullable': False,
9090
})
9191

92-
return super(OAS30Validator, self).iter_errors(instance, _schema)
92+
validator = self.evolve(schema=_schema)
93+
return super(OAS30Validator, validator).iter_errors(instance)
9394

9495

9596
class OAS31Validator(BaseOAS31Validator):

Diff for: poetry.lock

+47-50
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ classifiers = [
3232

3333
[tool.poetry.dependencies]
3434
python = "^3.7.0"
35-
jsonschema = ">=3.0.0, <5.0.0"
35+
jsonschema = "^4.0.0"
3636
rfc3339-validator = {version = "*", optional = true}
3737
strict-rfc3339 = {version = "*", optional = true}
3838
isodate = {version = "*", optional = true}
39+
attrs = ">=19.2.0"
3940

4041
[tool.poetry.extras]
4142
rfc3339-validator = ["rfc3339-validator"]

0 commit comments

Comments
 (0)