From 0494e62860c1f65b1d04a47c6117dd0b2bd00248 Mon Sep 17 00:00:00 2001 From: Pierre Sedon Date: Mon, 26 Aug 2024 14:53:51 +0200 Subject: [PATCH] Use previously modified object when multiple extensions extend the same object --- lib/schema/cache.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/schema/cache.ex b/lib/schema/cache.ex index 0a26c13..4d5a6df 100644 --- a/lib/schema/cache.ex +++ b/lib/schema/cache.ex @@ -978,7 +978,9 @@ defmodule Schema.Cache do Logger.info("#{key} #{kind} is patching #{base_key}") - case Map.get(items, base_key) do + # First check the accumulator in case the same object is extended by multiple extensions, + # that way the previous modifications are taken into account + case Map.get(acc, base_key, Map.get(items, base_key)) do nil -> Logger.error("#{key} #{kind} attempted to patch invalid item: #{base_key}") System.stop(1)