diff --git a/aea/configurations/validation.py b/aea/configurations/validation.py index 568194e311..aff4217080 100644 --- a/aea/configurations/validation.py +++ b/aea/configurations/validation.py @@ -295,10 +295,10 @@ def validate_data_with_pattern( excludes_: List[Tuple[str]] = [] else: excludes_ = excludes - pattern_path_value = { + original_config = { tuple(path): value for path, value in dict_to_path_value(pattern) } - data_path_value = {tuple(path): value for path, value in dict_to_path_value(data)} + overrides = {tuple(path): value for path, value in dict_to_path_value(data)} errors = [] def check_excludes(path: Tuple[str, ...]) -> bool: @@ -315,17 +315,17 @@ def is_a_dict_override(path: Tuple[str, ...]) -> bool: flag = False while len(path) > 0: path = path[:-1] - if path in pattern_path_value: - pattern_value = pattern_path_value[path] + if path in original_config: + pattern_value = original_config[path] flag = isinstance(pattern_value, OrderedDict) break return flag - for path, new_value in data_path_value.items(): + for path, new_value in overrides.items(): if check_excludes(path): continue - if path not in pattern_path_value: + if path not in original_config: if not is_a_dict_override(path=(*path,)): errors.append( f"Attribute `{'.'.join(path)}` is not allowed to be updated!" @@ -333,7 +333,7 @@ def is_a_dict_override(path: Tuple[str, ...]) -> bool: continue - pattern_value = pattern_path_value[path] + pattern_value = original_config[path] if pattern_value is None: # not possible to determine data type for optional value not set