I am trying to make thrift deserialization for jackason backward compatible
ObjectMapper mapper = getObjectMapper(false /* pretty */);
mapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); // This works
// This doesn't work
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
MapLikeType t = mapper.getTypeFactory().constructMapLikeType(LinkedHashMap.class, keyClass, valueClass);
return mapper.readValue(content, t);
valueClass
is of the following type
public class MyThrift implements org.apache.thrift.TBase<MyThrift, MyThrift._Fields>, java.io.Serializable, Cloneable, Comparable<MyThrift> {
I keep getting
com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of com.MyThrift$_Fields from String value 'MY_ID': value not one of declared Enum instance names
if I use FAIL_ON_UNKNOWN_PROPERTIES
But I don't get the same error if I use READ_UNKNOWN_ENUM_VALUES_AS_NULL
, can someone point me a direction on why using FAIL_ON_UNKNOWN_PROPERTIES
not work?
Does jackason bind not support FAIL_ON_UNKNOWN_PROPERTIES
for thrift ?