![Gato GraphQL logo](/_next/static/media/GatoGraphQL-logo-suki-rectangular.d3bab7ee.png)
Field To Input
Field To Input
Pass the value of field field
as input to another field via $__field
, and as input to a directive via field @passOnwards(as: "variableName")
.
{
posts {
excerpt
# Referencing previous field with name "excerpt"
isEmptyExcerpt: _isEmpty(value: $__excerpt)
# Referencing previous field with alias "isEmptyExcerpt"
isNotEmptyExcerpt: _not(value: $__isEmptyExcerpt)
}
}
The response will be:
{
"data": {
"posts": [
{
"excerpt": "Some post excerpt",
"isEmptyExcerpt": false,
"isNotEmptyExcerpt": true
},
{
"excerpt": "",
"isEmptyExcerpt": true,
"isNotEmptyExcerpt": false
}
]
}
}