Update mutations.rst

This commit is contained in:
Justin Miller 2021-04-12 22:40:08 -07:00 committed by GitHub
parent 17f6a45a47
commit 5acd04aa93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,9 +85,9 @@ We should receive:
InputFields and InputObjectTypes InputFields and InputObjectTypes
---------------------------------- ----------------------------------
InputFields are used in mutations to allow nested input data for mutations InputFields are used in mutations to allow nested input data for mutations.
To use an InputField you define an InputObjectType that specifies the structure of your input data To use an InputField you define an InputObjectType that specifies the structure of your input data:
.. code:: python .. code:: python
@ -112,7 +112,7 @@ To use an InputField you define an InputObjectType that specifies the structure
return CreatePerson(person=person) return CreatePerson(person=person)
Note that **name** and **age** are part of **person_data** now Note that **name** and **age** are part of **person_data** now.
Using the above mutation your new query would look like this: Using the above mutation your new query would look like this:
@ -128,7 +128,7 @@ Using the above mutation your new query would look like this:
} }
InputObjectTypes can also be fields of InputObjectTypes allowing you to have InputObjectTypes can also be fields of InputObjectTypes allowing you to have
as complex of input data as you need as complex of input data as you need:
.. code:: python .. code:: python
@ -160,7 +160,7 @@ To return an existing ObjectType instead of a mutation-specific type, set the **
def mutate(root, info, name): def mutate(root, info, name):
return Person(name=name) return Person(name=name)
Then, if we query (``schema.execute(query_str)``) the following: Then, if we query (``schema.execute(query_str)``) with the following:
.. code:: .. code::