mjlorenzo
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
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










