Skip to content

Can't use a Union type in a connection #356

Closed

Description

@tangerilli

If I have something like this:

class SomeTypeOne(ObjectType):
    pass

class SomeTypeTwo(ObjectType):
    pass

class MyUnion(Union):
    class Meta:
        types = (SomeTypeOne, SomeTypeTwo)

class Query(AbstractType):
    things = relay.ConnectionField(MyUnion)

it fails with AssertionError: Only ObjectTypes can have a Node interface. If the last line is changed to:

things = graphene.Field(MyUnion)

then it works fine.

Is there another way to do this, or is it just not supported yet?

Activity

  1. tangerilli commented on Nov 15, 2016

    @tangerilli
    Author

    @syrusakbary the commit above changes the error, but doesn't allow unions to be used in a connection. I submitted #367 which does allow unions to be used in a connection. But if there's a better way to do it, I'm happy to hear it 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions