I'm using swagger-codegen to generate a rest client, but I get a problem, the service I'm consuming returns a model with an inheritance, the API model looks like this:
public class Person
{
private List<Book> books;
...
}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "typeClass")
@JsonSubTypes({ @JsonSubTypes.Type(value = Magazine.class) })
public class Book
{
//some prop
}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "typeClass")
public class Magazine extends Book
{
//some prop
}
The API model is annotated with jackson annotations to deal with inheritance. The API works ok. When I generate the client, the client models don't have the jackson annotations, so when I use the generated client to consume the API, it always deserializate using the Book class. It doesn't "see" the Magazine class. I think it's because the generated model does'nt have the jackson annotations to deal with inheritance.
How can I config the swagger-codegen to add the jackson annotations to the model.
Thanks a lot...