Skip to content

Commit 7f6aa56

Browse files
committed
Announce 1.2
* New diff implementation (courtesy of Randy Watler) * Mark old diff implementation as deprecated Francis Galiegue (26): Announce version 1.1 Merge pull request #1 from rwatler/factorizing-diff Update copyrights Changes to pom.xml: add contributors JsonFactorizingDiff: modify a little JsonFactorizingDiff: modify more code JsonFactorizingDiff: more modifications JsonFactorizingDiff: replace Integer.MAX_VALUE with -1 for "not array index" JsonFactorizingDiff: more changes JsonFactorizingDiff: more changes JsonFactorizingDiff: refactor DiffOperation Add comments in DiffOperation JsonFactorizingDiff: implement .toString() on Diff{,Operation} JsonDiff: some code simplification JsonFactorizingDiff: take advantage of ArrayNode's properties JsonFactorizingDiff: refactor getLCSDiffs a little Update README Update README again Merge pull request #2 from rwatler/master Merge pull request #3 from rwatler/master JsonFactorizingDiff: add comments Move JsonFactorizingDiff into its own package Add javadoc to new JsonDiff implementation; obsolete old one. Schedule old JSON diff removal for 1.3, not 1.4 pom.xml: remove unused javadoc link 1.2 Randy Watler (3): Add proposed Factorizing JSON Diff implementation Revise factorizing implementation and test cases to cover multiple overlapping add/remove diff array index adjustments Add factorizing support for converting duplicate add to copy operations
1 parent 5922bdc commit 7f6aa56

File tree

2 files changed

+14
-33
lines changed

2 files changed

+14
-33
lines changed

README.markdown

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ below for more information.
1515

1616
## Versions
1717

18-
The current version is **1.1**.
18+
The current version is **1.2**.
1919

2020
## Maven artifact
2121

@@ -31,43 +31,24 @@ Replace _your-version-here_ with the appropriate version:
3131

3232
## JSON "diff": the two implementations
3333

34-
The first implementation, available in 1.1, is fully functional but is quite naive.
34+
### New implementation (versions 1.2 and above)
3535

36-
It is functional in the sense that given two JSON values, it will always generate the correct JSON
37-
Patch (as a `JsonNode`). It is however quite naive in the sense that it does not try and factorize
38-
any operations. That is, given the two following JSON values:
39-
40-
```json
41-
{ "a": 1 }
42-
```
36+
The new implementation (`com.github.fge.jsonpatch.diff.JsonDiff`) is able, unlike the old one, to
37+
factorize add and remove operations into both moves and copies.
4338

44-
and:
39+
This implementation is courtesy of [Randy Watler](https://github.com/rwatler) and should now be used
40+
in preference to the old one.
4541

46-
```json
47-
{ "b": 1 }
48-
```
42+
### Old implementation (versions 1.1 and below)
4943

50-
this naive implementation
51-
([link](https://github.com/fge/json-patch/blob/master/src/main/java/com/github/fge/jsonpatch/JsonDiff.java))
52-
will generate the following:
44+
The old implementation (`com.github.fge.jsonpatch.JsonDiff`), available since version 1.1, is fully
45+
functional but is quite naive.
5346

54-
```json
55-
[
56-
{ "op": "add", "path": "/b", "value": 1 },
57-
{ "op": "remove", "path": "/a" }
58-
]
59-
```
60-
61-
There is, however, a second implementation
62-
([link](https://github.com/fge/json-patch/blob/master/src/main/java/com/github/fge/jsonpatch/JsonFactorizingDiff.java)),
63-
courtesy of [Randy Watler](https://github.com/rwatler), which is able to generate a "factorized"
64-
form like this:
65-
66-
```json
67-
[ { "op": "move", "from": "/a", "path": "/b" } ]
68-
```
47+
It is functional in the sense that given two JSON values, it will always generate the correct JSON
48+
Patch (as a `JsonNode`). It is however quite naive in the sense that it does not try and factorize
49+
any operations.
6950

70-
This code will make it in 1.2 and will eventually become the default.
51+
Since 1.2, it is marked as obsolete, and you should consider using the newer one.
7152

7253
## Sample usage: JSON Patch
7354

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<groupId>com.github.fge</groupId>
2020
<artifactId>json-patch</artifactId>
2121
<name>json-patch</name>
22-
<version>1.2</version>
22+
<version>1.3-SNAPSHOT</version>
2323
<packaging>jar</packaging>
2424
<description>JSON Patch implementation in Java</description>
2525
<url>https://github.com/fge/json-patch</url>

0 commit comments

Comments
 (0)