Ash FrameworkAF
Ash Framework3y ago
10 replies
Robert Graff

Duplicate input types for GraphQL

Given a resource like this

defmodule Package
  attributes do
     attribute :options, {:array, Option}, allow_nil?: false
  end

  graphql do
    type :package
    mutations do
      create :create
      update :add_option, :add_option, identity: :key
    end
  end

  actions do
    defaults [:create]

    update :add_option do
      accept []
      argument :option, Option, allow_nil?: false
      ...
    end
  end


I get multiple errors about duplicate related to Option (UnionType) and its children (OptionString, OptionBoolean).

Type name "OptionString" is not unique.

References to types must be unique.


If I comment out the update mutation, it generates all the types as expected for the create. The update mutation should not require any additional type or input types.
Was this page helpful?