Hello. I need your help!
I have a schema like this.
object :profile do
field :phone_number, non_null(:string)
field :active, non_null(:boolean)
field :category, non_null(:string)
field :tags, :tags, resolve: dataloader(Users)
end
object :tags do
field :name, non_null(:string)
end
in ecto schema.
schema "profiles" do
field :phone_number, :string
field :active, :boolean, default: false
field :category, :string
many_to_many :tags, Tag,
join_through: "profile_tags"
on_replace: :delete
timestamps()
end
when I do query like this
{
profile {
phone_number
tags {
name
}
}
got an error like this
** (BadMapError) expected a map, got: []
(elixir) lib/map.ex:451: Map.get([], :name, nil)
(absinthe) lib/absinthe/middleware/map_get.ex:9: Absinthe.Middleware.MapGet.call/2
I think when the absinthe resolves value from tags, it is not a map, it is list of tags. So I need to change default function(Map.get) to other.
How can I customize this while using Dataloader?