Generated refetch definition with variables can not pass the validation of backend, such as github.com/vektah/gqlparser/v2
bonafideyan opened this issue · 0 comments
bonafideyan commented
for example, a query which has a variable that is required contains a refetchable fragment, relay permit does not provide the variable for refetch, (it still provide value of the variable in last query), so the refetch definition write the variable as is NOT required.
query mainQuery($var: Boolean!) {
...mainFragment @relay(mask: true)
}
fragment mainFragment on Query @refetchable(queryName: "MainFragmentQuery") {
something @include(if: $var)
}
and generated refetch definition:
query MainFragmentQuery(
**$var: Boolean**
) {
...mainFragment
}
but that can not pass the validation of backend, such as github.com/vektah/gqlparser/v2, because it think the $var should be required when it see $var is used in @include.
I have no idea how to solve this problem, or where do I make mistake?
thanks!