From aee12273316fa1a773e6bdf1ed10c7a10bc886f4 Mon Sep 17 00:00:00 2001 From: kuba-mazurkiewicz Date: Mon, 2 Dec 2024 15:51:39 +0100 Subject: [PATCH] Update the logic to check whether an item is already present in destination[key] before running merge_list_item --- iac_validate/yaml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iac_validate/yaml.py b/iac_validate/yaml.py index 1c9bbb6..82553de 100644 --- a/iac_validate/yaml.py +++ b/iac_validate/yaml.py @@ -148,7 +148,8 @@ def merge_dict( destination[key] = value[:] if isinstance(destination[key], list): for i in value: - merge_list_item(i, destination[key], merge_list_items) + if i not in destination[key]: + merge_list_item(i, destination[key], merge_list_items) else: destination[key] = value return destination