Skip to content

Commit 25c2c7b

Browse files
committed
Add integration test for add_field with $last wildcard
#102 Behaviour seems to have changed #102 breaks and master ingores if there is no object in the array and you use to `add_field` with $last wildcard
1 parent 5dafbbe commit 25c2c7b

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"animals" : [ {
3+
"name" : "Jake",
4+
"type" : "dog"
5+
}, {
6+
"name" : "Blacky",
7+
"type" : "bird",
8+
"key" : "value"
9+
} ]
10+
}
11+
{
12+
"animals" : [ ]
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"animals" : [
3+
{
4+
"name": "Jake",
5+
"type": "dog"
6+
},
7+
{
8+
"name": "Blacky",
9+
"type": "bird"
10+
}
11+
]
12+
}
13+
{
14+
"animals" : [ ]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_field("animals[].$last.key", "value")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FLUX_DIR + "input.json"
2+
|open-file
3+
|as-records
4+
|decode-json
5+
|fix(FLUX_DIR + "test.fix")
6+
|encode-json(prettyPrinting="true")
7+
|write(FLUX_DIR + "output-metafix.json")
8+
;

0 commit comments

Comments
 (0)