Improved mutation docs

This commit is contained in:
Syrus Akbary 2017-07-26 22:33:59 -07:00
parent 5c58d9e686
commit fa512cfa50
2 changed files with 4 additions and 4 deletions

View File

@ -22,8 +22,8 @@ subclass of ``relay.ClientIDMutation``.
@classmethod @classmethod
def mutate_and_get_payload(cls, input, context, info): def mutate_and_get_payload(cls, input, context, info):
ship_name = input.get('ship_name') ship_name = input.ship_name
faction_id = input.get('faction_id') faction_id = input.faction_id
ship = create_ship(ship_name, faction_id) ship = create_ship(ship_name, faction_id)
faction = get_faction(faction_id) faction = get_faction(faction_id)
return IntroduceShip(ship=ship, faction=faction) return IntroduceShip(ship=ship, faction=faction)

View File

@ -13,7 +13,7 @@ This example defines a Mutation:
import graphene import graphene
class CreatePerson(graphene.Mutation): class CreatePerson(graphene.Mutation):
class Input: class Arguments:
name = graphene.String() name = graphene.String()
ok = graphene.Boolean() ok = graphene.Boolean()
@ -98,7 +98,7 @@ To use an InputField you define an InputObjectType that specifies the structure
age = graphene.Int(required=True) age = graphene.Int(required=True)
class CreatePerson(graphene.Mutation): class CreatePerson(graphene.Mutation):
class Input: class Arguments:
person_data = PersonInput(required=True) person_data = PersonInput(required=True)
person = graphene.Field(Person) person = graphene.Field(Person)