with a schema:
interface I_Actor {
id:ID!
name:String @search
}
type User implements I_Actor{
username:String! @search
}
type Robot implements I_Actor{
robotname:String! @search
}
and these data (2 Users and 2 Robots):
query qq {
queryI_Actor{
id
name
...on User{ username }
...on Robot{ robotname }
}
}
-->>
{
"data": {
"queryI_Actor": [
{
"id": "0x2712",
"name": "a1",
"username": "user1"
},
{
"id": "0x2713",
"name": "a2",
"username": "user2"
},
{
"id": "0x2714",
"name": "a4",
"robotname": "robot2"
},
{
"id": "0x2715",
"name": "a3",
"robotname": "robot1"
}
]
}
}
I’d like to query I_Actor
of a specific type .
there’s no filter option for filtering out implementations
so I tried
query qq {
queryI_Actor(first:3) @cascade{
...on User{
id
name
username
}
}
}
-->>
{
"data": {
"queryI_Actor": [
{
"id": "0x2712",
"name": "a1",
"username": "user1"
},
{
"id": "0x2713",
"name": "a2",
"username": "user2"
}
]
}
}
seems to work…
but selecting the other type
query qq {
queryI_Actor(first:3) @cascade{
...on Robot{
id
name
robotname
}
}
}
-->>
{
"data": {
"queryI_Actor": [
{
"id": "0x2714",
"name": "a4",
"robotname": "robot2"
}
]
}
}
that’s because it counts the skipped items too , in fact withouot @cascade these are the responses:
for Users:
{
"data": {
"queryI_Actor": [
{
"id": "0x2712",
"name": "a1",
"username": "user1"
},
{
"id": "0x2713",
"name": "a2",
"username": "user2"
},
{} # <- this is a Robot
]
}
}
for Robots:
{
"data": {
"queryI_Actor": [
{}, # <- this is a User
{}, # <- this is a User
{
"id": "0x2714",
"name": "a4",
"robotname": "robot2"
}
]
}
}