@@ -100,6 +100,16 @@ def _get_values_for_config(self, config_schema_db, config_db):
100100 config = self ._assign_default_values (schema = schema_values , config = config )
101101 return config
102102
103+ @staticmethod
104+ def _get_object_property_schema (object_schema ):
105+ additional_properties = object_schema .get ("additionalProperties" , {})
106+ if isinstance (additional_properties , dict ):
107+ property_schema = defaultdict (lambda : additional_properties )
108+ else :
109+ property_schema = {}
110+ property_schema .update (object_schema .get ("properties" , {}))
111+ return property_schema
112+
103113 def _assign_dynamic_config_values (self , schema , config , parent_keys = None ):
104114 """
105115 Assign dynamic config value for a particular config item if the ite utilizes a Jinja
@@ -132,12 +142,7 @@ def _assign_dynamic_config_values(self, schema, config, parent_keys=None):
132142 # Inspect nested object properties
133143 if is_dictionary :
134144 parent_keys += [str (config_item_key )]
135- additional_properties = schema_item .get ("additionalProperties" , {})
136- if isinstance (additional_properties , dict ):
137- property_schema = defaultdict (lambda : additional_properties )
138- else :
139- property_schema = {}
140- property_schema .update (schema_item .get ("properties" , {}))
145+ property_schema = self ._get_object_property_schema (schema_item )
141146 self ._assign_dynamic_config_values (
142147 schema = property_schema ,
143148 config = config [config_item_key ],
@@ -190,18 +195,21 @@ def _assign_default_values(self, schema, config):
190195 default_value = schema_item .get ("default" , None )
191196 is_object = schema_item .get ("type" , None ) == "object"
192197 has_properties = schema_item .get ("properties" , None )
198+ has_additional_properties = schema_item .get ("additionalProperties" , None )
193199
194200 if has_default_value and not has_config_value :
195201 # Config value is not provided, but default value is, use a default value
196202 config [schema_item_key ] = default_value
197203
198204 # Inspect nested object properties
199- if is_object and has_properties :
205+ if is_object and ( has_properties or has_additional_properties ) :
200206 if not config .get (schema_item_key , None ):
201207 config [schema_item_key ] = {}
202208
209+ property_schema = self ._get_object_property_schema (schema_item )
210+
203211 self ._assign_default_values (
204- schema = schema_item [ "properties" ] , config = config [schema_item_key ]
212+ schema = propety_schema , config = config [schema_item_key ]
205213 )
206214
207215 return config
0 commit comments