Currently it is not possible to filter on types that implement interfaces.
Given this schema:
type Blub {
id: String!
blas: [Bla!]!
}
interface Bla {
blaValue: String! @search(by: [hash])
}
type Foo implements Bla {
fooValue: Int! @search
}
I want to query all Blub
but filter blas
for fooValue
when the underlying type is Foo
.
query {
queryBlub {
id
blas {
blaValue
... on Foo {
fooValue
}
}
}
}
Allowing arguments (and corresponding filter logic) on inline fragments would certainly help here:
query {
queryBlub {
id
blas {
blaValue
... on Foo (filter: { fooValue: {gt: 0 } }) {
fooValue
}
}
}
}
A current workaround which involves a wrapped type and @cascade
that I found.
Schema:
type Blub {
id: String!
blas: [Bla!]!
}
interface Bla {
blaValue: String! @search(by: [hash])
}
type WrappedInt {
value: Int! @search
}
type Foo implements Bla {
fooValue: WrappedInt!
}
query:
query {
queryBlub {
id
blas @cascade {
blaValue
... on Foo {
fooValue(filter: {value: {gt: 0 } }) {
value
}
}
}
}
}
It should be clear though, that such workarounds are not good and should not be needed.
I’ll also reference this here because I see similarities.