Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple object redefinitions in extensions #108

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion lib/schema_web/views/page_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ defmodule SchemaWeb.PageView do
if observable_object do
observable_object[:attributes][:type_id][:enum]
else
{nil, nil}
nil
end

cond do
Expand Down
Loading