Skip to content

Commit

Permalink
handle cases where the type has no short name
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasJ committed Feb 8, 2024
1 parent 3526f87 commit 2a4a27d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/resource/resource.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2224,7 +2224,11 @@ defmodule AshGraphql.Resource do

defp do_get_expressable_types(operator_types, field_type, array_type?) do
field_type_short_name =
Ash.Type.short_names() |> Enum.find(fn {_, type} -> type == field_type end) |> elem(0)
case Ash.Type.short_names()
|> Enum.find(fn {_, type} -> type == field_type end) do
nil -> nil
{short_name, _} -> short_name
end

operator_types
|> Enum.filter(fn
Expand All @@ -2243,7 +2247,7 @@ defmodule AshGraphql.Resource do
[:any, type] when is_atom(type) ->
true

[^field_type_short_name, type] when is_atom(type) ->
[^field_type_short_name, type] when is_atom(type) and not is_nil(field_type_short_name) ->
true

_ ->
Expand Down

0 comments on commit 2a4a27d

Please sign in to comment.