Let’s say I have a basic type called an article
object :article do
field(:id, :id)
field(:author, :string)
field(:body, :string)
end
I can have a query like this:
query do
field :articles, list_of(:article) do
...
end
end
But if I did this
mutation do
field :upload_articles, :boolean do
arg(:input, non_null(:upload_article_input))
end
end
input_object :upload_article_input do
field(:articles, non_null(list_of(:article)))
end
I get this error
Introspection must provide input type for arguments, but received: [Article]!.
My hack around this was to create
input_object :input_article do
field(:id, :id)
field(:author, :string)
field(:body, :string)
end
input_object :upload_article_input do
field(:articles, non_null(list_of(:input_article)))
end
and use that in the input, but since it’s fundamentally the same as the object :article, is there a better way to do this?