How to implement jackson multi polymorphism using Swagger

32 views
Skip to first unread message

Sourav Bhattacharjee

unread,
Sep 25, 2017, 5:51:57 AM9/25/17
to Swagger

I have 3 classes as described below:


public class Flow extends FE {

   
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
   
@JsonSubTypes({ @JsonSubTypes.Type(value = A.class, name = "a"),
           
@JsonSubTypes.Type(value = F.class, name = "f") })

//Attributes are available here
private List<FE> el = null;
}


public class A extends FE {

// Attributes are available here

}


public abstract class FE{

//Abstract class does not have any member variable                

}


I want to write a swagger.json such that all the relationship mentioned above should be maintained. Even the '@JsonSubTypes' tags are there to help 
creating a perfect json that I want. But to achieve the above functionality what should to write in the swagger.json so that I can generate similar
functionality in the swagger generated code?

Ron Ratovsky

unread,
Sep 27, 2017, 2:55:23 PM9/27/17
to swagger-sw...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages