There is a class annotated with @JsonIgnoreProperties
(base class) and some subclasses extending it.
Now, in one Post API, the request body (a map) could be type of any of the subclasses. I have written code to create instance of base class based on an additional type property (using object mapper). But since my base and subclasses are annotated with @JsonIgnoreProperties
, even if I'm sending incorrect pair of properties and data, mapping is not failing.
How do I fail this? There are other APIs using this base and subclass and hence I don't want to tamper with the existing classes. Is there a way to nullify this ignore check or something during the switch case conversion?