Take a look at 
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#composition-and-inheritance-polymorphism.

 

 

 

From: <[email protected]> on behalf of Sourav 
Bhattacharjee <[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Monday, September 25, 2017 at 02:52
To: Swagger <[email protected]>
Subject: How to implement jackson multi polymorphism using 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?
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.


-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to