Version: 20.11.0
Schema:
interface Meta {
id: String! @id @search(by: [hash])
}
interface Generic {
names: [String!]!
}
type Movie implements Meta & Generic {
description: String!
rating: Int!
}
type Comic implements Meta & Generic {
description: String!
}
Mutation:
mutation{
addMovie(input:[{id:"abc",names:["xyz"],description:"dgraph",rating:1}]){
movie{
id
names
description
rating
}
}
addComic(input:[{id:"def",names:["uvw"],description:"comic-dgraph"}]){
comic{
id
names
description
}
}
}
Query:
query {
queryMeta(first:2) @cascade{
... on Movie {
names
}
}
}
Expected behavior:
Because we asked to expand only Movie
, we expect the result to be only the name “xyz”.
Actual behavior:
{
"data": {
"queryMeta": [
{
"names": [
"xyz"
]
},
{}
]
},
"extensions": {
"touched_uids": 6,
"tracing": {
"version": 1,
"startTime": "2020-12-20T14:14:27.8401613Z",
"endTime": "2020-12-20T14:14:27.8415112Z",
"duration": 1350000,
"execution": {
"resolvers": [
{
"path": [
"queryMeta"
],
"parentType": "Query",
"fieldName": "queryMeta",
"returnType": "[Meta]",
"startOffset": 115700,
"duration": 1219700,
"dgraph": [
{
"label": "query",
"startOffset": 159200,
"duration": 1152000
}
]
}
]
}
}
}
}
The cascade seems to not remove the empty result of the Comic
, behaving in the same way of the query without the @cascade.
Running a query which ask for a field present only in Movie (rating
), cascade behaves correctly
Query:
query {
queryMeta(first:2) @cascade{
... on Movie {
rating
}
}
}
Result
{
"data": {
"queryMeta": [
{
"rating": 1
}
]
},
"extensions": {
"touched_uids": 6,
"tracing": {
"version": 1,
"startTime": "2020-12-20T14:17:19.6258508Z",
"endTime": "2020-12-20T14:17:19.6271512Z",
"duration": 1300500,
"execution": {
"resolvers": [
{
"path": [
"queryMeta"
],
"parentType": "Query",
"fieldName": "queryMeta",
"returnType": "[Meta]",
"startOffset": 103900,
"duration": 1179700,
"dgraph": [
{
"label": "query",
"startOffset": 182200,
"duration": 1081000
}
]
}
]
}
}
}
}