mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-23 01:56:54 +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 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user