Does GraphQL have the possibility for the client to tell the server that it wants a field only if that field is not null
?
Given the query
query HeroAndFriends {
hero {
name
friends {
name
}
}
}
the response should then look like
{
"data": {
"hero": {
"friends": [
{
"name": "Luke Skywalker"
},
{
"name": "Han Solo"
},
{
"name": "Leia Organa"
}
]
}
}
}
instead of
{
"data": {
"hero": {
"name": null,
"friends": [
{
"name": "Luke Skywalker"
},
{
"name": "Han Solo"
},
{
"name": "Leia Organa"
}
]
}
}
}
Is this possible without violating the GraphQL specification?