My question is the following, I can receive a JSON, where inside it can come two types of class "CHANGE" or "WITHDRAW" in the same type of request. Below is an example JSON 1 and JSON 2
JSON 1
{
"name":"Eduard Jack",
"change":{
"agency":"3213"
}
}
JSON 2
{
"name":"john Stev",
"withdraw":{
"documentNumber":"121212"
}
}
When I make this request I get a string from json where I make a mapper to convert into an object, in the OPENAPI documentation it tells me that it is oneOf, it can be one or the other, never both together. How can I make the code understand which class to deserialize into in the Java 11?