Hey folks!
So first off, I understand completely that import_types
causes conflicts when used in non-schema modules that are then imported themselves as types in the schema module, and that the solution is to only call import_types
within the schema module.
My issue is that if you do not explicitly import_types
a given type, you can’t use import_fields
on that type. As an example, say I have a more primitive type:
defmodule Primitive do
use Absinthe.Schema.Notation
object :primitive do
field :a, :integer
field :b, :string
end
end
I want this to be a sort of reusable fragment in numerous other types:
defmodule TypeOne do
use Absinthe.Schema.Notation
import_types Primitive # this is necessary or import_fields doesn't work
object :type_one do
import_fields :primitive
...
end
end
defmodule TypeTwo do
use Absinthe.Schema.Notation
import_types Primitive # again this is necessary or import_fields doesn't work
object :type_one do
import_fields :primitive
...
end
end
Once you start importing these types into the main schema however, you run into the duplicate type definition issue: References to types must be unique.
. I’m on an old version of Absinthe (v1.4.0) that unfortunately I can’t change, anyone have any thoughts?
Thanks!
Mike