Skip to content

Instantly share code, notes, and snippets.

@mphuie
Created January 4, 2018 05:41
Show Gist options
  • Save mphuie/aadeac193fed6eb7f6805404fec48c91 to your computer and use it in GitHub Desktop.
Save mphuie/aadeac193fed6eb7f6805404fec48c91 to your computer and use it in GitHub Desktop.
graphql graphene simple mutation
class User(graphene.ObjectType):
id = graphene.ID()
firstname = graphene.String()
lastname = graphene.String(required=False)
class Mutation(graphene.ObjectType):
create_user = graphene.Field(User, firstname=graphene.String(required=True), lastname=graphene.String())
def resolve_create_user(self, args, **kwargs):
print(kwargs)
firstname = kwargs.get('firstname')
return User(id=1, firstname=firstname, lastname="qwpok")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment