From 3e5cf20023f3990aff2d66c7307e3479d2a357ad Mon Sep 17 00:00:00 2001 From: Rebecca Le <543859+sevenseacat@users.noreply.github.com> Date: Sun, 21 Jul 2024 23:54:52 +0800 Subject: [PATCH] bugfix: Fix check for checking if a field is filterable or not (#198) --- lib/resource/info.ex | 4 ++-- test/support/resources/tag.ex | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/resource/info.ex b/lib/resource/info.ex index d7a7344..6b298ab 100644 --- a/lib/resource/info.ex +++ b/lib/resource/info.ex @@ -190,9 +190,9 @@ defmodule AshGraphql.Resource.Info do end @doc "May the specified field be filtered on?" - def filterable_field?(resource, field) do + def filterable_field?(resource, field_name) do filterable_fields = AshGraphql.Resource.Info.filterable_fields(resource) - is_nil(filterable_fields) or field.name in filterable_fields + is_nil(filterable_fields) or field_name in filterable_fields end end diff --git a/test/support/resources/tag.ex b/test/support/resources/tag.ex index 9def3ab..09b1e84 100644 --- a/test/support/resources/tag.ex +++ b/test/support/resources/tag.ex @@ -9,6 +9,8 @@ defmodule AshGraphql.Test.Tag do graphql do type(:tag) + filterable_fields [:name] + queries do get :get_tag, :read list :get_tags, :read