Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add @removeNullVariables directives (#477)
* fix: upgrade graphql-go-tools with input coercion fix * chore: add errors with explanation text to operation parse, normalize and validate stages * chore: fmt * chore: add removeNullVariables directive to base schema * chore: add remove null variables directive description to docs * chore: update graphql-go-tools to v1.60.3 * chore: update base grapphql schema docs for @removeNullVariable directive * chore: update test snapshots * chore: fix node tests, update goldie * chore: fmt
- Loading branch information
Sergiy Petrunin
committed
Dec 27, 2022
1 parent
2d211c9
commit 0f4398b
Showing
11 changed files
with
148 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...-website/src/pages/docs/directives-reference/remove-null-variables-directive.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
title: '@removeNullVariables Directive' | ||
pageTitle: WunderGraph - Directives - @removeNullVariables | ||
description: | ||
--- | ||
|
||
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. | ||
|
||
```graphql | ||
query ($say: String, $name: String) @removeNullVariables { | ||
hello(say: $say, name: $name) | ||
} | ||
``` | ||
|
||
The directive `@removeNullVariables` will transform variables json and remove top level null values. | ||
|
||
```json | ||
{ "say": null, "name": "world" } | ||
``` | ||
|
||
So upstream will receive the following variables: | ||
|
||
```json | ||
{ "name": "world" } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 20 additions & 1 deletion
21
packages/sdk/src/definition/__snapshots__/merge.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package apihandler | ||
|
||
const ( | ||
ErrMsgOperationParseFailed = "failed to parse operation: %w" | ||
ErrMsgOperationNormalizationFailed = "failed to normalize operation: %w" | ||
ErrMsgOperationValidationFailed = "operation validation failed: %w" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0f4398b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wundergraph-docs – ./
wundergraph-docs-git-main-wunder-graph.vercel.app
wundergraph-docs.vercel.app
docs.wundergraph.com
wundergraph-docs-wunder-graph.vercel.app