graphql @include directive
This is an example of graphql @include directive. The purpose of the @include directive is to allow a field to be retrieve or not based on a condition. In this case, it is determined by $inculdeStatus.
Given that we are passing in $includeStatus = false, the field status will be excluded.
query GetReportsByUserId($includeStatus: Boolean!)
{
getReportsByUserId(userId: "123", limit: 10) {
status
reports {
propertyType
id
status @include(if: $includeStatus)
}
}
}
variables
{
"userId": "123",
"limit": 10,
"includeStatus": false
}
Comments