diff --git a/msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/JsonArrayFormat.java b/msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/JsonArrayFormat.java index c49290c07..9711e1b88 100644 --- a/msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/JsonArrayFormat.java +++ b/msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/JsonArrayFormat.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.introspect.Annotated; +import com.fasterxml.jackson.databind.introspect.AnnotatedClass; import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; import static com.fasterxml.jackson.annotation.JsonFormat.Shape.ARRAY; @@ -17,6 +18,10 @@ public class JsonArrayFormat extends JacksonAnnotationIntrospector { private static final JsonFormat.Value ARRAY_FORMAT = new JsonFormat.Value().withShape(ARRAY); + /** + * Defines array format for serialized entities with ObjectMapper, without actually + * including the schema + */ @Override public JsonFormat.Value findFormat(Annotated ann) { @@ -28,4 +33,21 @@ public JsonFormat.Value findFormat(Annotated ann) return ARRAY_FORMAT; } + + /** + * Defines that unknown properties will be ignored, and won't fail the un-marshalling process. + * Happens in case of de-serialization of a payload that contains more properties than the actual + * value type + */ + @Override + public Boolean findIgnoreUnknownProperties(AnnotatedClass ac) + { + // If the entity contains JsonIgnoreProperties annotation, give it higher priority. + final Boolean precedenceIgnoreUnknownProperties = super.findIgnoreUnknownProperties(ac); + if (precedenceIgnoreUnknownProperties != null) { + return precedenceIgnoreUnknownProperties; + } + + return true; + } }