Created
January 4, 2018 05:41
-
-
Save mphuie/aadeac193fed6eb7f6805404fec48c91 to your computer and use it in GitHub Desktop.
graphql graphene simple mutation
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
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