最佳答案
您需要使用 @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类,并使用 @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;
}