Skip to content

Commit

Permalink
handle additionalProperties in pack config
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd committed Apr 8, 2021
1 parent 4f28540 commit bffccc5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion st2common/st2common/util/config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from __future__ import absolute_import
import copy

from collections import defaultdict

import six

from oslo_config import cfg
Expand Down Expand Up @@ -130,8 +132,14 @@ def _assign_dynamic_config_values(self, schema, config, parent_keys=None):
# Inspect nested object properties
if is_dictionary:
parent_keys += [str(config_item_key)]
additional_properties = schema_item.get("additionalProperties", {})
if isinstance(additional_properties, dict):
property_schema = defaultdict(additional_properties)
else:
property_schema = {}
property_schema.update(schema_item.get("properties", {}))
self._assign_dynamic_config_values(
schema=schema_item.get("properties", {}),
schema=property_schema,
config=config[config_item_key],
parent_keys=parent_keys,
)
Expand Down

0 comments on commit bffccc5

Please sign in to comment.