Update mutation example

This commit is contained in:
Syrus Akbary 2016-06-10 01:43:06 -07:00
parent 01ddc83c4b
commit 888d5037da

View File

@ -40,10 +40,13 @@ from graphene import ObjectType, Mutation, String
class ReverseString(Mutation): class ReverseString(Mutation):
class Input: class Input:
input = String() input = String(required=True)
reversed = String() reversed = String()
def mutate(self, args, context, info):
reversed = args.get('input')[::-1]
return ReverseString(reversed=reversed)
class Query(ObjectType): class Query(ObjectType):
reverse_string = graphene.Field(ReverseString) # Old way, not working anymore reverse_string = graphene.Field(ReverseString) # Old way, not working anymore