Skip to content

Commit 0201bdc

Browse files
committed
fix-to(object): 修复忽略path
1 parent 6c797fd commit 0201bdc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

json-diff-core/src/main/java/me/codeleep/jsondiff/core/handle/object/ComplexObjectJsonNeat.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ private void keySetConversion(Set<String> expectKeys, Set<String> actualKeys) {
7979
List<MappingKey> mappingKeys = keyMap.stream().filter(mappingKey -> {
8080
String actualTravelPath = PathUtil.getObjectPath(travelPath.getActualTravelPath()) + mappingKey.getActualKey();
8181
String expectTravelPath = PathUtil.getObjectPath(travelPath.getExpectTravelPath()) + mappingKey.getExpectKey();
82-
if (ignorePath.contains(actualTravelPath) || ignorePath.contains(expectTravelPath) ) {
82+
String abstractActualTravelPath = PathUtil.getObjectPath(travelPath.getAbstractTravelPath()) + mappingKey.getActualKey();
83+
String abstractExpectTravelPath = PathUtil.getObjectPath(travelPath.getAbstractTravelPath()) + mappingKey.getExpectKey();
84+
if (ignorePath.contains(abstractActualTravelPath) || ignorePath.contains(abstractExpectTravelPath) || ignorePath.contains(actualTravelPath) || ignorePath.contains(expectTravelPath) ) {
8385
return false;
8486
}
8587
return true;

json-diff-test/src/main/resources/array/MultArrays.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4322,6 +4322,7 @@
43224322
},
43234323
{
43244324
"caseName": "忽略根下的数组 后续改进【目前不支持】",
4325+
"skip": true,
43254326
"actual": [
43264327
[
43274328
{
@@ -4339,7 +4340,7 @@
43394340
],
43404341
"option": {
43414342
"ignorePath": [
4342-
"$[*][]"
4343+
"$[*][*]"
43434344
]
43444345
}
43454346
},

0 commit comments

Comments
 (0)