I have an existing service created with SpringMvc. He is already used and accept an object like that :
public class MyDto{
private AType a;
private BType b;
//and corresponding getters and setters
}
and corresponding Json
{
a: {},
b: {}
}
And i want to change the cardinality of A to :
public class MyDto{
private List<AType> a;
private BType b;
//and corresponding getters and setters
}
and the corresponding json :
{
a: [{}],
b: {}
}
But i want to continue to accept the json from the first representation because i can't easily update all the consumer of my api.
My first idea was to create a version 2 of my api because this is breaking change. But i think this too much because if the api consumer send one element i can just create a list of one element.
But i don't know if i can do that with spring mvc.