Skip to content

Commit d91af87

Browse files
committed
resolved review comments
1 parent 1345f30 commit d91af87

File tree

6 files changed

+22
-46
lines changed

6 files changed

+22
-46
lines changed

value/arguments/api.graphql

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,18 @@ type Query {
2626
)
2727
# To pass a constant value directly in a query and return the result
2828
pi:Float! @value(const:3.14159)
29+
30+
# To sum a and b using the @value directive within src in jsonata,
31+
sum(a: Int!, b: Int!): Int! @value(script: {src: "a+b", language: JSONATA})
32+
33+
# To concatenate strings using @value in jsonata
34+
concat(a: String, b: String): String
35+
@value(
36+
script: {
37+
src: """
38+
$join([a,b], "-")
39+
"""
40+
language: JSONATA
41+
}
42+
)
2943
}

value/arguments/tests/Test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ const {
2424
query: '{pi}',
2525
expected: {pi:3.14159},
2626
},
27+
{ label: "return sum of two input using @value with script-json",
28+
query: '{sum(a: 10, b: 10)}',
29+
expected: {sum: 20},
30+
},
31+
{ label: "concat string",
32+
query: '{concat(a: "Steve",b:"Jobs" )}',
33+
expected: {concat: 'Steve-Jobs'},
34+
},
2735
]
2836
return deployAndRun(__dirname, tests, stepzen.admin);
2937
});

value/useOfJSON/api.graphql

Lines changed: 0 additions & 18 deletions
This file was deleted.

value/useOfJSON/index.graphql

Lines changed: 0 additions & 3 deletions
This file was deleted.

value/useOfJSON/stepzen.config.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

value/useOfJSON/tests/Test.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)