-
Notifications
You must be signed in to change notification settings - Fork 329
/
firstSample.json
47 lines (43 loc) · 1.6 KB
/
firstSample.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
"input": {
"rating": {
"primary": {
"value": 4,
"max": 5
},
"quality": {
"value": 3,
"max": 7
}
}
},
"spec": {
"rating": {
"primary": {
"value": "Rating", // simple match. Put the value '4' in the output under the "Rating" field
"max": "RatingRange"
},
// match any children of "rating".
// Shiftr has a precendence order when matching, so the "*" will match anything that isn't "primary"
"*": {
"value": "SecondaryRatings.&1.Value", // &1 means, go up one level and grab that value and substitute it in
"max": "SecondaryRatings.&1.Range", // in this example &1 = "quality"
"$": "SecondaryRatings.&1.Id"
// we want "quality" to be a value field in the output under
// "SecondaryRatings.quality.Id", but "quality" is an input key not an input value.
// The "$" operator means use the input key, instead of the input value, to place in the output
}
}
},
"expected": {
"Rating": 4,
"RatingRange": 5,
"SecondaryRatings": {
"quality": { // created by the '"value": "SecondaryRatings.&1.Value"' or "max": "SecondaryRatings.&1.Range" lines
"Id": "quality", // created by the '"$": "SecondaryRatings.&1.Id"' from the spec
"Value": 3,
"Range": 7
}
}
}
}