Parametric union for absithe schema

Dear All,

I have a repetativ task in the schema definition of my absinthe project.
I have a lot of fields where the {"enabled": false} means the object is disabled,
and {"enabled": true, ...} means the object is enabled. I try to use union field:

  union :foo_selection do
    types [:foo, :disabled]
    resolve_type fn
      %{enabled: false}, _ -> :disabled
      _, _ -> :foo

  object :disabled do
    field :enabled, :boolean, default_value: false

  object :foo do
    field :enabled, :boolean, default_value: true
    field :name, :string

I would like to have a parametric union construct where I can put :foo as parameter.
I’m quite new at the macro field of Elixir, could anyone suggest how could I do this?

Best regards,