Skip to content

Commit 622da9c

Browse files
committed
Make the CatalogMapper more reproducible
This will affect the Platform generator and make sure the JSON files of the Platform are generated reproducibly.
1 parent 545907d commit 622da9c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/catalog/CatalogMapperHelper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
import java.io.Writer;
99
import java.nio.file.Files;
1010
import java.nio.file.Path;
11+
import java.util.Locale;
12+
import java.util.TimeZone;
1113

1214
import com.fasterxml.jackson.core.JsonParser;
1315
import com.fasterxml.jackson.databind.DeserializationFeature;
16+
import com.fasterxml.jackson.databind.MapperFeature;
1417
import com.fasterxml.jackson.databind.ObjectMapper;
1518
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
1619
import com.fasterxml.jackson.databind.SerializationFeature;
@@ -43,6 +46,10 @@ public static ObjectMapper initMapper(ObjectMapper mapper) {
4346
mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
4447
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.KEBAB_CASE);
4548
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
49+
mapper.enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY);
50+
mapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
51+
mapper.setLocale(Locale.US);
52+
mapper.setTimeZone(TimeZone.getTimeZone("UTC"));
4653
return mapper;
4754
}
4855

0 commit comments

Comments
 (0)