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


This content originally appeared on DEV Community and was authored by Shruti Pahuja

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
}
}


This content originally appeared on DEV Community and was authored by Shruti Pahuja


Print Share Comment Cite Upload Translate Updates
APA

Shruti Pahuja | Sciencx (2024-09-20T11:36:17+00:00) Default value for field with @include directive. Retrieved from https://www.scien.cx/2024/09/20/default-value-for-field-with-include-directive/

MLA
" » Default value for field with @include directive." Shruti Pahuja | Sciencx - Friday September 20, 2024, https://www.scien.cx/2024/09/20/default-value-for-field-with-include-directive/
HARVARD
Shruti Pahuja | Sciencx Friday September 20, 2024 » Default value for field with @include directive., viewed ,<https://www.scien.cx/2024/09/20/default-value-for-field-with-include-directive/>
VANCOUVER
Shruti Pahuja | Sciencx - » Default value for field with @include directive. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/20/default-value-for-field-with-include-directive/
CHICAGO
" » Default value for field with @include directive." Shruti Pahuja | Sciencx - Accessed . https://www.scien.cx/2024/09/20/default-value-for-field-with-include-directive/
IEEE
" » Default value for field with @include directive." Shruti Pahuja | Sciencx [Online]. Available: https://www.scien.cx/2024/09/20/default-value-for-field-with-include-directive/. [Accessed: ]
rf:citation
» Default value for field with @include directive | Shruti Pahuja | Sciencx | https://www.scien.cx/2024/09/20/default-value-for-field-with-include-directive/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.