title | pageTitle | description |
---|---|---|
@removeNullVariables Directive |
WunderGraph - Directives - @removeNullVariables |
The @removeNullVariables
directive allows you to remove variables with null value from your GraphQL Query or Mutation Operations.
A potential use-case could be that you have a graphql upstream which is not accepting null values for variables. By enabling this directive all variables with null values will be removed from upstream query.
query ($say: String, $name: String) @removeNullVariables {
hello(say: $say, name: $name)
}
The directive @removeNullVariables
will transform variables json and remove top level null values.
{ "say": null, "name": "world" }
So upstream will receive the following variables:
{ "name": "world" }