You need to annonatate your Rest method with @ApiResponses and @ApiResponse.
For e.g.
@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)
}
)
Annonatate your Json Response class with @ApiModel and its field with @ApiModelProperty like
@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;
}