How can I use middleware in Absinthe?

Hi guys.
I am building graphql backend server using absinthe and phoenix.
My app use Youtube Data Api to get video list from specific channel.
But Api response from youtube data api seems not following elixir standard for the key of map.
It looks like this.

%GoogleApi.YouTube.V3.Model.SearchResultSnippet {
  channelId: "some channel id",
  channelTitle: "some channel title",

in My schema file

object :snippet do
  field :channel_id, :string
  field :channel_title, :string

But query result returns null for channel_id, and channel_title.
So I just do like this.

object :snippet do
  field :channel_id, :string do
    resolve(fn parent, _, _ ->
      channel_id = Map.get(parent, :channelId)
      {:ok, channel_id}

then it works.
But I don’t want to repeat this for every field.
Is there any way solve this problem using middleware in Absinthe?

Hi @freewebwithme,

I don’t think that Absinthe middleware is going to help here. Normal resolvers should do just fine. The result you’re getting from Youtube is a struct. If you want to return it to users in a different shape than you get from the API you need to write a function that transforms it from what is there to what you want.