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?
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.The problem here is that anytime I change the file that defines these types, GraphQL complains. Apparently, the
GraphQL::Schema::Traversal.visitmethod 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?