From debd8224477518457bf06729616fe5ee4fafe16f Mon Sep 17 00:00:00 2001 From: Henry Le Grys Date: Sun, 1 May 2022 15:34:48 +0100 Subject: [PATCH] Hotfix package builder emitting JSON with missing keys for empty values The meaning of `mapper.setSerializationInclusion` changed with the Jackson upgrade, which meant that empty collections were being fully stripped from the output. Fix by changing the strategy to NON_ABSENT, which only strips nulls and "absent" values like Optional.absent --- .../main/java/com/skcraft/launcher/builder/PackageBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher-builder/src/main/java/com/skcraft/launcher/builder/PackageBuilder.java b/launcher-builder/src/main/java/com/skcraft/launcher/builder/PackageBuilder.java index 6b85f989a..422248f7d 100644 --- a/launcher-builder/src/main/java/com/skcraft/launcher/builder/PackageBuilder.java +++ b/launcher-builder/src/main/java/com/skcraft/launcher/builder/PackageBuilder.java @@ -407,7 +407,7 @@ public static void main(String[] args) throws IOException, InterruptedException // Initialize SimpleLogFormatter.configureGlobalLogger(); ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT); + mapper.setSerializationInclusion(JsonInclude.Include.NON_ABSENT); Manifest manifest = new Manifest(); manifest.setMinimumVersion(Manifest.MIN_PROTOCOL_VERSION);