Skip to content

Commit da5992d

Browse files
authored
Merge pull request #136 from bsara/master
Jackson mapper default property inclusion should be "ALWAYS" to prevent null values from being omitted in query results
2 parents 153a0a0 + 4ec73bb commit da5992d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/graphql/servlet/GraphQLObjectMapper.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package graphql.servlet;
22

3+
import com.fasterxml.jackson.annotation.JsonInclude;
34
import com.fasterxml.jackson.core.JsonProcessingException;
45
import com.fasterxml.jackson.core.type.TypeReference;
56
import com.fasterxml.jackson.databind.MappingIterator;
@@ -43,8 +44,10 @@ public ObjectMapper getJacksonMapper() {
4344
if (result == null) { // First check (no locking)
4445
synchronized(this) {
4546
result = mapper;
46-
if (result == null) // Second check (with locking)
47-
mapper = result = objectMapperProvider.provide();
47+
if (result == null) { // Second check (with locking)
48+
mapper = result = objectMapperProvider.provide().copy();
49+
mapper.setDefaultPropertyInclusion(JsonInclude.Include.ALWAYS);
50+
}
4851
}
4952
}
5053

0 commit comments

Comments
 (0)