Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Generated refetch definition with variables can not pass the validation of backend, such as github.com/vektah/gqlparser/v2 #259

Open
bonafideyan opened this issue Jan 30, 2021 · 0 comments

Comments

@bonafideyan
Copy link

bonafideyan commented Jan 30, 2021

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant