4
4
from six import iteritems
5
5
6
6
from openapi_core .compat import lru_cache
7
+ from openapi_core .schema .extensions .generators import ExtensionsGenerator
7
8
from openapi_core .schema .properties .generators import PropertiesGenerator
8
9
from openapi_core .schema .schemas .models import Schema
9
- from openapi_core .schema .schemas .types import Contribution
10
+ from openapi_core .schema .schemas .types import Contribution , NoValue
10
11
11
12
log = logging .getLogger (__name__ )
12
13
@@ -21,9 +22,8 @@ def create(self, schema_spec):
21
22
22
23
schema_type = schema_deref .get ('type' , None )
23
24
schema_format = schema_deref .get ('format' )
24
- model = schema_deref .get ('x-model' , None )
25
25
required = schema_deref .get ('required' , False )
26
- default = schema_deref .get ('default' , None )
26
+ default = schema_deref .get ('default' , NoValue )
27
27
properties_spec = schema_deref .get ('properties' , None )
28
28
items_spec = schema_deref .get ('items' , None )
29
29
nullable = schema_deref .get ('nullable' , False )
@@ -47,6 +47,8 @@ def create(self, schema_spec):
47
47
min_properties = schema_deref .get ('minProperties' , None )
48
48
max_properties = schema_deref .get ('maxProperties' , None )
49
49
50
+ extensions = self .extensions_generator .generate (schema_deref )
51
+
50
52
properties = None
51
53
if properties_spec :
52
54
properties = self .properties_generator .generate (properties_spec )
@@ -68,7 +70,7 @@ def create(self, schema_spec):
68
70
additional_properties = self .create (additional_properties_spec )
69
71
70
72
return Schema (
71
- schema_type = schema_type , model = model , properties = properties ,
73
+ schema_type = schema_type , properties = properties ,
72
74
items = items , schema_format = schema_format , required = required ,
73
75
default = default , nullable = nullable , enum = enum ,
74
76
deprecated = deprecated , all_of = all_of , one_of = one_of ,
@@ -79,9 +81,15 @@ def create(self, schema_spec):
79
81
exclusive_maximum = exclusive_maximum ,
80
82
exclusive_minimum = exclusive_minimum ,
81
83
min_properties = min_properties , max_properties = max_properties ,
84
+ extensions = extensions ,
82
85
_source = schema_deref ,
83
86
)
84
87
88
+ @property
89
+ @lru_cache ()
90
+ def extensions_generator (self ):
91
+ return ExtensionsGenerator (self .dereferencer )
92
+
85
93
@property
86
94
@lru_cache ()
87
95
def properties_generator (self ):
0 commit comments