Skip to content

Instantly share code, notes, and snippets.

@erebus1
Last active November 12, 2019 13:52
Show Gist options
  • Save erebus1/872dd946ac3c35bff0ed8f5d9f604b75 to your computer and use it in GitHub Desktop.
Save erebus1/872dd946ac3c35bff0ed8f5d9f604b75 to your computer and use it in GitHub Desktop.
from graphene import ObjectType, Int, List, String, Field, NonNull
from graphene_federation import build_schema, extend, external
@extend(fields='id')
class FileNode(ObjectType):
id = external(Int(required=True))
class MessageNode(ObjectType):
id = Int(required=True)
thread_id = Int(required=True)
author_id = Int()
files = List(NonNull(FileNode))
body = String(required=True)
class Query(ObjectType):
message = Field(lambda: MessageNode, id=Int())
schema = build_schema(Query)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment