Skip to content

Commit

Permalink
Use previously modified object when multiple extensions extend the sa…
Browse files Browse the repository at this point in the history
…me object
  • Loading branch information
PierreSedon committed Aug 26, 2024
1 parent 040e906 commit 0494e62
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/schema/cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0494e62

Please sign in to comment.