Skip to content

fix: diff report more object members in actual #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/hisp/dhis/jsontree/JsonDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private static void diffNumber(JsonNumber e, JsonNumber a, Mode mode, Consumer<D

private static void diffObject(
JsonObject e, JsonObject a, Mode mode, Consumer<Difference> add, PropertyInfo p) {
if (!p.anyAdditional(mode.objects.anyAdditional) && e.size() != a.size()) {
if (!p.anyAdditional(mode.objects.anyAdditional)) {
// list all extra members
a.keys()
.filter(not(e::has))
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/org/hisp/dhis/jsontree/JsonDiffTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ void testObject() {
assertDiff("{\"a\":[1,2,3]}", "{\"a\":[1,5,3]}", "!= $.a[1]: 2 <> 5");
}

@Test
void testObject_Pager() {
assertDiff(
"""
{"page":1, "pageSize":50}""",
"""
{"paga":1, "pageSize":50.0}""",
DEFAULT,
"++ $.paga: ? <> 1",
"-- $.page: 1 <> ?");
}

private interface JsonAnyAnnotationObject extends JsonObject {

@JsonDiff.AnyOrder
Expand Down