forked from loafle/openapi-generator-original
Disable Jackson FAIL_ON_INVALID_SUBTYPE in feign (#5597)
* Disable Jackson FAIL_ON_INVALID_SUBTYPE in feign With this change, Jackson does not fail even if it doesn't recognize a discriminator type name. This is helpful when upgrading a microservice with a new subtype while keeping compatibility with its old clients. The instance is returned as null instead of throwing an exception deep in the feign framework, allowing clients to gracefully degrade. * Disable FAIL_ON_INVALID_SUBTYPE for all Jackson-based projects
This commit is contained in:
committed by
wing328
parent
de427297ec
commit
be3cfda3ce
@@ -16,6 +16,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
|
||||
mapper = new ObjectMapper();
|
||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
|
||||
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||
|
||||
Reference in New Issue
Block a user