File tree 4 files changed +21
-6
lines changed
4 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -94,9 +94,9 @@ Report format:
94
94
``` diff
95
95
$ jaydiff --report --show-types old.json new.json
96
96
97
- - .b[]: float64 3
98
- + .b[]: float64 5
99
- + .b[]: float64 4
97
+ - .b[1 ]: float64 3
98
+ + .b[1 ]: float64 5
99
+ + .b[2 ]: float64 4
100
100
- .c.a: string toto
101
101
+ .c.a: string titi
102
102
- .c.b: float64 23
@@ -137,8 +137,8 @@ Ignore Excess values (useful when checking for backward compatibility):
137
137
``` diff
138
138
$ jaydiff --report --show-types --ignore-excess old.json new.json
139
139
140
- - .b[]: float64 3
141
- + .b[]: float64 5
140
+ - .b[1 ]: float64 3
141
+ + .b[1 ]: float64 5
142
142
- .c.a: string toto
143
143
+ .c.a: string titi
144
144
- .c.b: float64 23
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"github.com/gobwas/glob"
5
+ "github.com/yazgazan/jaydiff/jpath"
5
6
)
6
7
7
8
type ignorePattern struct {
@@ -25,6 +26,7 @@ func (p *ignorePatterns) UnmarshalFlag(s string) error {
25
26
}
26
27
27
28
func (p ignorePatterns ) Match (s string ) bool {
29
+ s = jpath .StripIndices (s )
28
30
for _ , pattern := range p {
29
31
if pattern .Match (s ) {
30
32
return true
Original file line number Diff line number Diff line change 3
3
"b" : [
4
4
1 ,
5
5
5 ,
6
- 4
6
+ 4
7
7
],
8
8
"c" : {
9
9
"a" : " titi" ,
Original file line number Diff line number Diff line change 26
26
fi
27
27
echo
28
28
29
+ echo " ./jaydiff --show-types --ignore(all):"
30
+ ./jaydiff --indent=' ' --show-types \
31
+ --ignore=' .b\[\]' --ignore=' .[c-h]' \
32
+ test_files/lhs.json test_files/rhs.json
33
+ CODE=$?
34
+ if [[ $CODE -ne 0 ]]; then
35
+ echo " FAIL with code $CODE "
36
+ FAILED=1
37
+ else
38
+ echo " OK"
39
+ fi
40
+ echo
41
+
29
42
echo " ./jaydiff --report --show-types:"
30
43
./jaydiff --report --indent=' ' --show-types \
31
44
test_files/lhs.json test_files/rhs.json
You can’t perform that action at this time.
0 commit comments