-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
2.17Issues planned at earliest for 2.17Issues planned at earliest for 2.17most-wantedTag to indicate that there is heavy user +1'ing actionTag to indicate that there is heavy user +1'ing action
Milestone
Description
Using a deserialization view and DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, it could be convenient if an error was raised when attempting to deserialize a property that is not part of the view.
In the following example code, the property annotatedWithView2 (which is not part of the deserialization view, View1) is correctly ignored during deserialization, but no error is raised.
This could be seen as an extension of #343 for views.
interface View1 { }
interface View2 { }
static class T {
public Long unannotated;
@JsonView(View1.class)
public Long annotatedWithView1;
@JsonView(View2.class)
public Long annotatedWithView2;
}
public static void main(String[] args) throws IOException {
T t = new ObjectMapper()
.enable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES)
.readerWithView(View1.class)
.withType(T.class)
.readValue("{ \"unannotated\":1, \"annotatedWithView1\":1, \"annotatedWithView2\":1 }");
System.out.println(t.unannotated + " " + t.annotatedWithView1 + " " + t.annotatedWithView2);
}
molexx, Hawk707, kaniyan and mikeheeren
Metadata
Metadata
Assignees
Labels
2.17Issues planned at earliest for 2.17Issues planned at earliest for 2.17most-wantedTag to indicate that there is heavy user +1'ing actionTag to indicate that there is heavy user +1'ing action