How can I mark as ignored some properties using json schema or jsonschema2pojo plugin? Sometimes I do receive these properties, sometimes I do not.
Here is the exception I am having:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "warnings" (class com.xyz.music.napster.v2.metadata.MetaVO), not marked as ignorable (2 known properties: "returnedCount", "totalCount"]) at [Source: okhttp3.ResponseBody$BomAwareReader@49f94818; line: 1, column: 15846] (through reference chain: com.xyz.music.napster.v2.metadata.PlaylistsResponseVO["meta"]->com.xyz.music.napster.v2.metadata.MetaVO["warnings"])
Here is my schema for MetaVO
class
{
"properties": {
"returnedCount": {
"type": "integer"
},
"totalCount": {
"type": "integer"
}
},
"type": "object"
}
For the moment I have found if I set the following annotation on MetaVO
class
@JsonIgnoreProperties(ignoreUnknown = true)
my problem is solved.
However these classes are auto-generated by the plugin (and according to our project specs they have to stay so).
Is it possible to do anything like this from json schema or jsonschema2pojo plugin?
I managed to solve the issue by switching from jackson-converter to gson-converter.