commit 3be9f20055b0b427e5d8647540dc540330dd4332 Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Aug 8 10:56:12 2018 +0200
Fix JSON serialization of history objects.
Fixes #27039. --- CHANGELOG.md | 6 ++++++ .../java/org/torproject/onionoo/docs/GraphHistory.java | 15 +++++++++++++++ 2 files changed, 21 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md index 99422f7..55b0d63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# Changes in version 6.2-1.16.? - 2018-08-?? + + * Medium changes + - Fix JSON serialization of history objects. + + # Changes in version 6.2-1.16.0 - 2018-08-03
* Medium changes diff --git a/src/main/java/org/torproject/onionoo/docs/GraphHistory.java b/src/main/java/org/torproject/onionoo/docs/GraphHistory.java index 495f01a..303bae4 100644 --- a/src/main/java/org/torproject/onionoo/docs/GraphHistory.java +++ b/src/main/java/org/torproject/onionoo/docs/GraphHistory.java @@ -3,8 +3,23 @@
package org.torproject.onionoo.docs;
+import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + import java.util.List;
+/* Use snake_case for naming fields rather than camelCase. */ +@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) +/* Exclude fields that are null or empty. */ +@JsonInclude(JsonInclude.Include.NON_EMPTY) +/* Only consider fields, no getters, setters, or constructors. */ +@JsonAutoDetect(creatorVisibility = JsonAutoDetect.Visibility.NONE, + fieldVisibility = JsonAutoDetect.Visibility.ANY, + getterVisibility = JsonAutoDetect.Visibility.NONE, + isGetterVisibility = JsonAutoDetect.Visibility.NONE, + setterVisibility = JsonAutoDetect.Visibility.NONE) public class GraphHistory {
private String first;
tor-commits@lists.torproject.org