-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add fromJson and mustFromJson to values func map (#164)
* feat: add fromJson and mustFromJson to values func map Signed-off-by: William Poussier <william.poussier@gmail.com> * fix: tests Signed-off-by: William Poussier <william.poussier@gmail.com> * fix: return a reflect value Signed-off-by: William Poussier <william.poussier@gmail.com> * doc: add better example of fromJSON template func Signed-off-by: William Poussier <william.poussier@gmail.com>
- Loading branch information
Showing
4 changed files
with
65 additions
and
7 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
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,22 @@ | ||
name: jsonParsing | ||
description: Ensure that JSON can be parsed and used as value in template | ||
title_format: "[test] correct json parsing" | ||
auto_runnable: true | ||
|
||
variables: | ||
- name: rawJSON | ||
expression: > | ||
var o = {"a":"utask","b":666,"c":{"k":"v"},"d":["1","2","3"]}; | ||
JSON.stringify(o); | ||
steps: | ||
stepOne: | ||
description: first step | ||
action: | ||
type: echo | ||
configuration: | ||
output: | ||
a: '{{(eval `rawJSON` | fromJson).a}}' | ||
b: '{{(eval `rawJSON` | mustFromJson).b}}' | ||
c: '{{(eval `rawJSON` | mustFromJson).c}}' | ||
d: '{{(eval `rawJSON` | fromJson).d}}' |
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