Skip to content

Reference resolving for federation support #107

@fabianriewe

Description

@fabianriewe

Hello,
I am currently working on a project where I use the Apollo Federation Gateway and graphene-federation to connect multiple Microservices. For each external Type I need to add the following resolver to the type.

def __resolve_reference(self, info, **kwargs):
    return MY_MODEL.objects.get(id=self.id)

Couldn't we just add something like the following to the MongoEngineObjectType?

@classmethod
def __resolve_reference(cls, info):
    return cls._meta.model.objects.get(id=self.id)

The only problem is that we need to resolve the reference by the Types key which isn't alwasy the id (just in my case). It could be any property of the model.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions