I have global enums and types defined in a type module, that are referenced as field types in other type modules.
For example, the global_types.ex
has:
defmodule MyApp.Schema.GlobalTypes do
use Absinthe.Schema.Notation
enum :sort_order do
value(:asc)
value(:desc)
end
which I use in two other type module files similar to:
posts_types.ex
defmodule MyApp.Schema.FooTypes do
use Absinthe.Schema.Notation
import_types(MyApp.Schema.GlobalTypes)
object :posts_criteria do
field(:filter, :posts_filter)
field(:sort_order, :sort_order)
stores_types.ex
defmodule MyApp.Schema.BarTypes do
use Absinthe.Schema.Notation
import_types(MyApp.Schema.GlobalTypes)
object :stores_criteria do
field(:filter, :stores_filter)
field(:sort_order, :sort_order)
When I do this, I get the following error:
Absinthe type identifier :sort_order is not unique.
References to types must be unique.
> All types within a GraphQL schema must have unique names. No two provided
> types may have the same name. No provided type may have a name which
> conflicts with any built in types (including Scalar and Introspection
> types).
How one know how to get around this? I’m using the latest absinthe beta:
defp deps do
[
{:absinthe, "~> 1.5.0-beta", override: true},