如何使用@ApiModel批注使用相同的架构为swagger文档生成不同的示例

时间:2018-10-13 00:26:57

标签: spring-mvc swagger swagger-ui springfox

我想使用Order类架构在Swagger UI中显示两个不同的示例。您能帮我在这里使用什么注释吗?我在Swagger 2.0中使用Spring MVC

型号:

public class Order {

    @ApiModelProperty(value = "Order Event", required = true, example = "Pending/Declined/Charged")
    private String event;

    private String status;

    private String reason;
}

示例1:

{  
  "event": "PENDING",
  "status": "Approved"   
}

示例2:

{  
  "event": "DECLINED",
  "status": "denied",
  "reason": "payment error"
}

0 个答案:

没有答案