graphql / graphql/graphql-spec
[RFC] @skip/include directive: ability to define default/fallback value
- Dominant language
- JavaScript
- Stars
- 14.6k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Let's say my app have a React component with an associated GraphQL fragment.
This fragment is used in 10 distinct queries. As of today, field `x` always has to be fetched, but a new business requirement ask to not fetch this field, just for one of the 10 queries.
I can add the following to my fragment:
```graphql
x @skip(if: $skipX)
```
But now, I have to provide a $skipX variable for all of my 10 queries, which seem doable but annoying.
I've like to have a syntax like
```graphql
x @skip(if: $skipX = false)
```
so that I only have to modify the variables of a single query
What do you think about this?
Is there any alternative to my need which does not require modifying all my existing queries?
Contributor guide
Assessment
This issue has not been assessed yet.