22import logging
33
44from six import iteritems
5- from jsonschema import _validators
5+ from jsonschema . validators import Draft4Validator
66
77from openapi_spec_validator .decorators import DerefValidatorDecorator
88
@@ -13,21 +13,20 @@ class SpecValidatorsGeneratorFactory:
1313 """Generator factory for customized validators that follows $refs
1414 in the schema being validated.
1515 """
16-
1716 validators = {
18- '$ref' : _validators . ref ,
19- 'properties' : _validators . properties_draft4 ,
20- 'additionalProperties' : _validators . additionalProperties ,
21- 'patternProperties' : _validators . patternProperties ,
22- 'type' : _validators . type_draft4 ,
23- 'dependencies' : _validators . dependencies ,
24- 'required' : _validators . required_draft4 ,
25- 'minProperties' : _validators . minProperties_draft4 ,
26- 'maxProperties' : _validators . maxProperties_draft4 ,
27- 'allOf' : _validators . allOf_draft4 ,
28- 'oneOf' : _validators . oneOf_draft4 ,
29- 'anyOf' : _validators . anyOf_draft4 ,
30- 'not' : _validators . not_draft4 ,
17+ '$ref' ,
18+ 'properties' ,
19+ 'additionalProperties' ,
20+ 'patternProperties' ,
21+ 'type' ,
22+ 'dependencies' ,
23+ 'required' ,
24+ 'minProperties' ,
25+ 'maxProperties' ,
26+ 'allOf' ,
27+ 'oneOf' ,
28+ 'anyOf' ,
29+ 'not' ,
3130 }
3231
3332 @classmethod
@@ -38,5 +37,6 @@ def from_spec_resolver(cls, spec_resolver):
3837 :type instance_resolver: :class:`jsonschema.RefResolver`
3938 """
4039 deref = DerefValidatorDecorator (spec_resolver )
41- for key , validator_callable in iteritems (cls .validators ):
42- yield key , deref (validator_callable )
40+ for key , validator_callable in iteritems (Draft4Validator .VALIDATORS ):
41+ if key in cls .validators :
42+ yield key , deref (validator_callable )
0 commit comments