graphql-ruby
graphql-ruby copied to clipboard
Union resolve_type doesn't handle string class names
Describe the bug
At most places in Graphql Schema you can define string as Graphql Type and it's lazily constantized, but not in union resolve_type. Just for sake of consistency Union resolve_type should handle string class names
I'm open to this improvement, but I don't plan to work on it myself. In the meantime, you could work around this by adding a Schema.get_type(type_name)
call to your resolve_type
method, to turn the name into a type definition. For example:
def self.resolve_type(obj, ctx)
type_name = # somehow get the typename for obj
ctx.schema.get_type(type_name)
end
Let me know if you have any trouble with that approach!
I'm open to supporting this if someone wants to add it, but I don't plan to work on it myself, so I'm closing this issue.