Skip to content

Conversation

@bsara
Copy link
Contributor

@bsara bsara commented Nov 29, 2018

Currently, the object mapper created using ObjectMapperProvider & ObjectMapperConfigurer is unchanged before use. This includes the default property inclusion value of the ObjectMapper. It would never make sense to not have this value be anything other than JsonInclude.Include.ALWAYS since GraphQL query results are never to omit any requested property regardless of the value of the property.

In a project where both RESTful endpoints and GraphQL are used, the situation may arise where the RESTful endpoints are to omit properties from responses under certain conditions (e.g. omit all null values from the response). When this is the case and the project uses the same ObjectMapper for both the RESTful endpoints and the GraphQLServlet, then it would be most helpful to "ignore" the value set by the incoming ObjectMapper's default property inclusion value and set it to JsonInclude.Include.ALWAYS instead.

This PR fixes #135

…S' because GraphQL should always include all requested properties by default (fixes graphql-java-kickstart#135)
@bsara bsara changed the title Jackson mapper default property inclusion should be "ALWAYS" to prevent null values from being omitted in query results fixes #135 Jackson mapper default property inclusion should be "ALWAYS" to prevent null values from being omitted in query results (fixes #135) Nov 29, 2018
@bsara bsara changed the title Jackson mapper default property inclusion should be "ALWAYS" to prevent null values from being omitted in query results (fixes #135) Jackson mapper default property inclusion should be "ALWAYS" to prevent null values from being omitted in query results Nov 29, 2018
@oliemansm oliemansm merged commit da5992d into graphql-java-kickstart:master Dec 11, 2018
@oliemansm
Copy link
Member

@bsara Thanks!

@bsara
Copy link
Contributor Author

bsara commented Dec 12, 2018

@oliemansm 👍 Thanks for merging the change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jackson mapper default property inclusion should be "ALWAYS" to prevent null values from being omitted in query results

2 participants