Skip to content

Duplicate type definition found for name  #935

@volkanunsal

Description

@volkanunsal

I define fields on a type dynamically from an ActiveRecord attribute. I wrote a helper method for that and it basically loops over the attributes and calls field(name, type) inside the define block.

MyType = GraphQL::ObjectType.define do 
   Company.graphql_types do |name, type|
      field name, type
   end
end

The problem here is that anytime I change the file that defines these types, GraphQL complains. Apparently, the GraphQL::Schema::Traversal.visit method is doing an object identity check and it rejects types defined by a reloaded type file. I'm not sure what the best way forward would be to avoid this error. Do you have any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions