DEV Community

Shruti Pahuja
Shruti Pahuja

Posted on

Default value for field with @include directive

I have a requirement of adding a @include directive for querying a field in a particular fragment.

This fragment is being used across different queries in multiple modules so I'm having to inject a value for this field from each of these queries. I

Is there any way to assign a default value to a directive at the site of the directive?

fragment sampleFragment on SampleFragment {
// want to assign a default value here
fragmentSample @include(if: $condition) {
// code here
}
}

Top comments (0)