kontent-ai / java-packages

Delivery Java SDK for Kontent.ai including examples for Spring, Gradle, Kotlin and Java Android app
https://kontent.ai/learn/tutorials/develop-apps/overview/?tech=java
MIT License
14 stars 28 forks source link

Update Jackson configuration to ignore unknown fields #78

Closed aweigold closed 5 years ago

aweigold commented 5 years ago

Motivation

Issues like #77 and #73 are demonstrating that strict validation of responses in deserialization is problematic and can cause breaking changes for consumers.

Proposed solution

Configure the Jackson ObjectMapper to not fail on unknown properties and types.

Additional context

The ObjectMapper has a configure method which can be leveraged to adjust features of Jackson's behavior. See the DeserializationFeature for reference to related items.

aweigold commented 5 years ago

Unit tests should also be included to prove deserialization with both unknown types and unknown properties.

aweigold commented 5 years ago

This is completed in the 2.0 branch... needs to be merged into master.

MrJINXIN commented 5 years ago

hello, I had the same problem.Please, how do I write the Jackson configuration file for the ignore attribute

aweigold commented 5 years ago

Hi @MrJINXIN . This was fixed with the 2.0.3 release of the SDK.