File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 22
33import com .fasterxml .jackson .annotation .JsonFormat ;
44import com .fasterxml .jackson .databind .introspect .Annotated ;
5+ import com .fasterxml .jackson .databind .introspect .AnnotatedClass ;
56import com .fasterxml .jackson .databind .introspect .JacksonAnnotationIntrospector ;
67
78import static com .fasterxml .jackson .annotation .JsonFormat .Shape .ARRAY ;
@@ -17,6 +18,10 @@ public class JsonArrayFormat extends JacksonAnnotationIntrospector
1718{
1819 private static final JsonFormat .Value ARRAY_FORMAT = new JsonFormat .Value ().withShape (ARRAY );
1920
21+ /**
22+ * Defines array format for serialized entities with ObjectMapper, without actually
23+ * including the schema
24+ */
2025 @ Override
2126 public JsonFormat .Value findFormat (Annotated ann )
2227 {
@@ -28,4 +33,21 @@ public JsonFormat.Value findFormat(Annotated ann)
2833
2934 return ARRAY_FORMAT ;
3035 }
36+
37+ /**
38+ * Defines that unknown properties will be ignored, and won't fail the un-marshalling process.
39+ * Happens in case of de-serialization of a payload that contains more properties than the actual
40+ * value type
41+ */
42+ @ Override
43+ public Boolean findIgnoreUnknownProperties (AnnotatedClass ac )
44+ {
45+ // If the entity contains JsonIgnoreProperties annotation, give it higher priority.
46+ final Boolean precedenceIgnoreUnknownProperties = super .findIgnoreUnknownProperties (ac );
47+ if (precedenceIgnoreUnknownProperties != null ) {
48+ return precedenceIgnoreUnknownProperties ;
49+ }
50+
51+ return true ;
52+ }
3153}
You can’t perform that action at this time.
0 commit comments