In order to support mutation operation support input types is required.
mutation CreateReviewForEpisode($ep: Episode!, $review: ReviewInput!) {
createReview(episode: $ep, review: $review) {
stars
commentary
}
}
{
"operations": [
{
"operationName": "CreateReviewForEpisode",
"operationType": "mutation",
"variables": [
{
"name": "ep",
"type": "Episode!"
},
{
"name": "review",
"type": "ReviewInput!"
}
],
"source": "mutation CreateReviewForEpisode($ep: Episode!, $review: ReviewInput!) {\n createReview(episode: $ep, review: $review) {\n stars\n commentary\n }\n}",
"fields": [
{
"responseName": "createReview",
"fieldName": "createReview",
"type": "Review",
"fields": [
{
"responseName": "stars",
"fieldName": "stars",
"type": "Int!"
},
{
"responseName": "commentary",
"fieldName": "commentary",
"type": "String"
}
],
"fragmentSpreads": [],
"inlineFragments": []
}
],
"fragmentsReferenced": []
}
],
"fragments": [],
"typesUsed": [
{
"kind": "EnumType",
"name": "Episode",
"description": "The episodes in the Star Wars trilogy",
"values": [
{
"name": "NEWHOPE",
"description": "Star Wars Episode IV: A New Hope, released in 1977."
},
{
"name": "EMPIRE",
"description": "Star Wars Episode V: The Empire Strikes Back, released in 1980."
},
{
"name": "JEDI",
"description": "Star Wars Episode VI: Return of the Jedi, released in 1983."
}
]
},
{
"kind": "InputObjectType",
"name": "ReviewInput",
"description": "The input object sent when someone is creating a new review",
"fields": [
{
"name": "stars",
"description": "0-5 stars",
"type": "Int!",
"defaultValue": null
},
{
"name": "commentary",
"description": "Comment about the movie, optional",
"type": "String",
"defaultValue": null
},
{
"name": "favoriteColor",
"description": "Favorite color, optional",
"type": "ColorInput",
"defaultValue": null
}
]
},
{
"kind": "InputObjectType",
"name": "ColorInput",
"description": "The input object sent when passing in a color",
"fields": [
{
"name": "red",
"description": "",
"type": "Int!",
"defaultValue": null
},
{
"name": "green",
"description": "",
"type": "Int!",
"defaultValue": null
},
{
"name": "blue",
"description": "",
"type": "Int!",
"defaultValue": null
}
]
}
]
}