Created
February 27, 2018 02:48
-
-
Save knowsuchagency/a6af5a71a71c0ae8e5e23b22eb1fb82f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import graphene as g | |
from graphql.execution.executors.asyncio import AsyncioExecutor | |
class Author(g.ObjectType): | |
"""This is a human being.""" | |
id = g.Int(description='The primary key in the database') | |
first_name = g.String() | |
last_name = g.String() | |
age = g.Int() | |
# we can't use g.List(Book) | |
# directly since it's not | |
# yet defined | |
books = g.List(lambda: Book) | |
class Book(g.ObjectType): | |
"""A book, written by an author.""" | |
id = g.Int(description='The primary key in the database') | |
title = g.String(description='The title of the book') | |
published = g.String(description='The date it was published') | |
author = g.Field(Author) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment