Given a schema with three entities cases
,products
,noxe
where cases
and products
link to noxe via field data__noxe
and where the type noxe
is a union of two major versions Noxe_v1
and Noxe_v2
.
If the noxe
should be filtered (by parent AND other properties) then the code to filter might be duplicated
if put into the resolvers naively. The code can be easily be factored out but the duplication in the arguments remains AND
is complicated by the fact that different filters might be needed for different versions of Noxe.
Looking at the line 4: data__noxe(match:"some n2") {
we can see an argument data__value
which is supposed to define
a filter on field data__value
. When adding another filter only present in one of the versions
data__noxe(data__value:"eq:some n2" data__sometext:"contains:some") {
It would be nicer if the potential input arguments could be directly applied to the fields to avoid duplication on the server side and opt-in on the client side. See https://gist.github.com/matthiasg/c05696fd525768c735b57bdeca67c29e#file-4-field-level-filtering-mix