Skip to content

Commit

Permalink
fix: properly check for domain inclusion in json api router when inst…
Browse files Browse the repository at this point in the history
…alling
  • Loading branch information
zachdaniel committed Aug 26, 2024
1 parent d364887 commit 515b392
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/ash_json_api/domain/domain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,17 @@ defmodule AshJsonApi.Domain do

defp list_has_concat_domain?(zipper, domain) do
!!Igniter.Code.List.find_list_item_index(zipper, fn zipper ->
Igniter.Code.Function.function_call?(zipper, {Module, :concat}, 1) &&
Igniter.Code.Function.argument_equals?(zipper, 0, inspect(domain))
with true <- Igniter.Code.Function.function_call?(zipper, {Module, :concat}, 1),
{:ok, zipper} <- Igniter.Code.Function.move_to_nth_argument(zipper, 0),
true <- Igniter.Code.List.list?(zipper) do
Igniter.Code.Common.nodes_equal?(
zipper,
[inspect(domain)]
)
else
_ ->
false
end
end)
end
end

0 comments on commit 515b392

Please sign in to comment.