mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-22 09:36:44 +03:00
Update mutation example
This commit is contained in:
parent
01ddc83c4b
commit
888d5037da
|
@ -40,10 +40,13 @@ from graphene import ObjectType, Mutation, String
|
|||
|
||||
class ReverseString(Mutation):
|
||||
class Input:
|
||||
input = String()
|
||||
input = String(required=True)
|
||||
|
||||
reversed = String()
|
||||
|
||||
def mutate(self, args, context, info):
|
||||
reversed = args.get('input')[::-1]
|
||||
return ReverseString(reversed=reversed)
|
||||
|
||||
class Query(ObjectType):
|
||||
reverse_string = graphene.Field(ReverseString) # Old way, not working anymore
|
||||
|
|
Loading…
Reference in New Issue
Block a user