Skip to content

Commit c8813cb

Browse files
authored
Merge pull request #25 from lyang/patch-1
Fix DeprecationWarning from jsonschema
2 parents b36c12b + 759b2b4 commit c8813cb

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

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
@@ -56,12 +57,11 @@
5657
)
5758

5859

60+
@attrs
5961
class OAS30Validator(BaseOAS30Validator):
6062

61-
def __init__(self, *args, **kwargs):
62-
self.read = kwargs.pop('read', None)
63-
self.write = kwargs.pop('write', None)
64-
super(OAS30Validator, self).__init__(*args, **kwargs)
63+
read: bool = attrib(default=None)
64+
write: bool = attrib(default=None)
6565

6666
def iter_errors(self, instance, _schema=None):
6767
if _schema is None:
@@ -74,4 +74,5 @@ def iter_errors(self, instance, _schema=None):
7474
'nullable': False,
7575
})
7676

77-
return super(OAS30Validator, self).iter_errors(instance, _schema)
77+
validator = self.evolve(schema=_schema)
78+
return super(OAS30Validator, validator).iter_errors(instance)

poetry.lock

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

pyproject.toml

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

3434
[tool.poetry.dependencies]
3535
python = "^3.6.2"
36-
jsonschema = "*"
36+
jsonschema = "^4.0.0"
3737
rfc3339-validator = {version = "*", optional = true}
3838
strict-rfc3339 = {version = "*", optional = true}
3939
isodate = {version = "*", optional = true}
40+
attrs = ">=19.2.0"
4041

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

0 commit comments

Comments
 (0)