Skip to content

Commit 1a7254c

Browse files
committed
add a jsonata example, readme
1 parent af04b7e commit 1a7254c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

transforms/filter/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### Tranforms: Filtering
2+
3+
## ECMAScript
4+
5+
The `ecmascript` argument is great for writing filters.
6+
See https://stepzen.com/docs/custom-graphql-directives/directives#ecmascript for more information on `ecmascript`.
7+
We are picturing a real-life scenario in which you call a backend using the `endpoint` argument.
8+
See https://stepzen.com/docs/connecting-backends/how-to-connect-a-rest-service for more information on `@rest`.
9+
10+
### Quick try
11+
```
12+
stepzen deploy
13+
stepzen request '{customer(name: "John Doe") {id name}}'
14+
```
15+
16+
## JSONata
17+
18+
JSONata transforms provdes an alternate method for filtering
19+
customer_1 uses the `[ ... ]` filter to return all "customers" (`$`) that
20+
contain `name = the argument name`
21+
22+
The outer array constructor `[]` is used to defeat singleton sequence equivalence.
23+
24+
### Quick try
25+
```
26+
stepzen deploy
27+
stepzen request '{customer_1(name: "John Doe") {id name}}'
28+
```

0 commit comments

Comments
 (0)