I have a UserType and a custom one that can be Writer or Account.
For GraphQL, I assumed that I could use UserableUnion as follows:
UserableUnion = GraphQL::UnionType.define do name "Userable" description "Account or Writer object" possible_types [WriterType, AccountType] end
and then define my UserType as follows:
UserType = GraphQL::ObjectType.define do name "User" description "A user object" field :id, !types.ID field :userable, UserableUnion end
But I get schema contains Interfaces or Unions, so you must define a 'resolve_type (obj, ctx) -> { ... }' function
I tried putting resol_type in several places, but I can't figure it out?
Can anyone implement this now?
source share