2
2
import logging
3
3
4
4
from six import iteritems
5
- from jsonschema import _validators
5
+ from jsonschema . validators import Draft4Validator
6
6
7
7
from openapi_spec_validator .decorators import DerefValidatorDecorator
8
8
@@ -13,21 +13,20 @@ class SpecValidatorsGeneratorFactory:
13
13
"""Generator factory for customized validators that follows $refs
14
14
in the schema being validated.
15
15
"""
16
-
17
16
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' ,
31
30
}
32
31
33
32
@classmethod
@@ -38,5 +37,6 @@ def from_spec_resolver(cls, spec_resolver):
38
37
:type instance_resolver: :class:`jsonschema.RefResolver`
39
38
"""
40
39
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