答案 0 :(得分:4)
您需要使用 @ApiResponses 和 @ApiResponse 来宣布您的Rest方法。
例如
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of demand",responseContainer="List"),
@ApiResponse(code = 404, message = "Demand does not exist", response = Your Error response.class),
@ApiResponse(code = 500, message = "Internal server error", response = Your Error response.class)
}
)
使用 @ApiModel 对您的Json Response类进行Annonatate,并使用 @ApiModelProperty
对其字段进行宣传@ApiModel(description = "Your comment")
public class Demand implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(notes = "Your comments", required = true, example = "example value")
private String demandId;
}