Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 803 Bytes

remove-null-variables-directive.md

File metadata and controls

28 lines (21 loc) · 803 Bytes
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" }