Graphene-Django: Would like to use graphene.ObjectType for custom query

316 views Asked by At

I currently have a working query that is in this form:

class Query(graphene.AbstractType):
algorithms = graphene.String(id=graphene.String())


def resolve_algorithms(self, args, context, info):

  # Much code here that goes to external server to get data

  algorithms = {}  # Instantiate dictionary

  # Code here to populate this dictionary

  return algorithms

While this does work, it's a kludge because I'm forcing the dictionary object to be returned as a string. I've looked around for articles to show me how to change the type to graphene.ObjectType() but with no success.

Might someone know how?

Robert

0

There are 0 answers