Skip to content

DjangoObjectType duplicate models breaks Relay node resolution #107

Closed
@nickhudkins

Description

@nickhudkins

If you define the following two types, or types that follow this pattern (Same model, different names). The relay node resolver resolves the incorrect name (and therefore incorrect globalID) for the type registered 2nd.

class ThingA(DjangoObjectType):
    class Meta:
        model = Thing
        name = 'ThingA'
        interfaces = (relay.Node, )

class ThingB(DjangoObjectType):
    class Meta:
        model = Thing
        name = 'ThingB'
        interfaces = (relay.Node, )

Query (ThingA globalID) :

{
  node(id: "GhpbmdBOjE=") {
    id // "GhpbmdBOjE=" Correct!
  }
}

Query (ThingB globalID)

{
  node(id: "VGhpbmdCOjE=") {
    id // "GhpbmdBOjE=" Incorrect :(
  }
}

It appears that there is some commented out code to warn about this. However, it is commented out so I am unsure what the intention of the author was.

I am really just looking to see if this is "as designed". @syrusakbary

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