Skip to content

Commit 5666494

Browse files
authored
Exclude null poperties when rendering JSON (#302)
The generated JSON diff file is already fairly large for larger API specs, but is made especially large because a lot of unused properties in the objects are serialised as null properties.
1 parent ef6c3f2 commit 5666494

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/java/org/openapitools/openapidiff/core/output/JsonRender.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package org.openapitools.openapidiff.core.output;
22

3+
import com.fasterxml.jackson.annotation.JsonInclude;
34
import com.fasterxml.jackson.core.JsonProcessingException;
45
import com.fasterxml.jackson.databind.ObjectMapper;
56
import org.openapitools.openapidiff.core.model.ChangedOpenApi;
67

78
public class JsonRender implements Render {
8-
private final ObjectMapper objectMapper = new ObjectMapper();
9+
private final ObjectMapper objectMapper =
10+
new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
911

1012
@Override
1113
public String render(ChangedOpenApi diff) {

0 commit comments

Comments
 (0)