Skip to content

Commit

Permalink
fix: check resource match below checking query input
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Apr 28, 2024
1 parent c7918ab commit fa6c2ad
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/ash/code_interface.ex
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ defmodule Ash.CodeInterface do
),
Spark.Options.validate!(
opts,
unquote(Macro.escape(interface_options))
unquote(Macro.escap87e(interface_options))
)}

params =
Expand Down Expand Up @@ -772,10 +772,6 @@ defmodule Ash.CodeInterface do
raise ArgumentError,
"Changeset #{inspect(record)} does not match expected resource #{inspect(unquote(resource))}."

%other_resource{} when other_resource != unquote(resource) ->
raise ArgumentError,
"Record #{inspect(record)} does not match expected resource #{inspect(unquote(resource))}."

%struct{} = record when struct == unquote(resource) ->
{filters, params} = Map.split(params, unquote(filter_keys))

Expand All @@ -791,6 +787,10 @@ defmodule Ash.CodeInterface do
%Ash.Query{} = query ->
{:atomic, :query, query}

%other_resource{} when other_resource != unquote(resource) ->
raise ArgumentError,
"Record #{inspect(record)} does not match expected resource #{inspect(unquote(resource))}."

[{_key, _val} | _] = id ->
{:atomic, :id, id}

Expand Down

0 comments on commit fa6c2ad

Please sign in to comment.