removes keys from cache entry if they are not part of the new value serialization

This commit is contained in:
Mose Müller 2024-03-05 14:17:05 +01:00
parent b8a52c2e6a
commit 24a01c0982

View File

@ -273,10 +273,16 @@ def set_nested_value_by_path(
value_type = serialized_value.pop("type")
if "readonly" in current_dict and current_dict["type"] != "method":
current_dict["type"] = value_type
# TODO: this does not yet remove keys that are not present in the serialized new
# value
current_dict.update(serialized_value)
# removes keys that are not present in the serialized new value
keys_to_keep = set(serialized_value.keys()) | {"type", "readonly"}
for key in list(current_dict.keys()):
if key not in keys_to_keep:
current_dict.pop(key, None)
def get_nested_dict_by_path(
serialization_dict: dict[str, Any],