Libraries and dependencies are below.
import io.swagger.annotations.ApiModel;
> import io.swagger.annotations.ApiModelProperty;
> swaggerVersion = '2.6.1'
>
> compile ("io.springfox:springfox-swagger2:${swaggerVersion}")
> compile ("io.springfox:springfox-swagger-ui:${swaggerVersion}")
> compile ("io.springfox:springfox-staticdocs:${swaggerVersion}")
> compile
> ("org.springframework.restdocs:spring-restdocs-mockmvc:1.2.0.RELEASE")
14 Kasım 2017 Salı 22:38:18 UTC+3 tarihinde Ron yazdı:
>
> Which library do you use to generate the API definition?
>
>
>
>
>
> *From: *<[email protected] <javascript:>> on behalf of
> Gökhan Ayrancıoğlu <[email protected] <javascript:>>
> *Reply-To: *"[email protected] <javascript:>" <
> [email protected] <javascript:>>
> *Date: *Tuesday, November 14, 2017 at 01:59
> *To: *Swagger <[email protected] <javascript:>>
> *Subject: *How to define abstract property in Model - Swagger
>
>
>
> I am trying to implement Swagger to my rest api which is development with
> Java Spring Boot. There is a problem on model parts of swagger. The problem
> is Detail abstract class and extended classes are not seem in Swagger UI's
> and the other output files. I am just seeing the baseclass with detail
> object as null.
>
>
>
> You can find the code on below.
>
>
>
> public class BaseClass {
>
>
>
> @ApiModelProperty(value ="Id of baseClass.", readOnly = true)
>
> private String id;
>
>
>
> @ApiModelProperty(value = "Description of baseClass.")
>
> private String description;
>
>
>
> @ApiModelProperty(value = "Value is equal to subclass json object value.")
>
> private Detail detail;
>
> ...
>
>
>
> My abstract class which is attribute of baseclass.
>
>
>
> @ApiModel(value = "Detail",subTypes = {Page.class,Rank.class},discriminator =
> "detail")
>
> public abstract class Detail {
>
> }
>
>
>
> My extended classes from Detail Abstract Class;
>
>
>
> Page Class:
>
> @ApiModel(parent = Detail.class,value = "Page")
>
> public class Page extends Detail {
>
> @ApiModelProperty(value = "The page URL.")
>
> private String url;
>
> ...
>
>
>
> Rank Class:
>
>
>
> @ApiModel(parent = Detail.class,value = "Rank")
>
> public class Rank extends Detail {
>
>
>
> @ApiModelProperty(value = "Number List of Rank")
>
> private List<String> numbers;
>
> ...
>
> --
> 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] <javascript:>.
> 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.