Hi,
First of all, for my first post, hello to everyone, and thank you for your great work on Swagger.
I work with Java 1.7, Swagger 1.3.2 (spec 1.2), and spring mvc rest controllers.
Ok, now my question :
Let's say i have some some method that returns a response (a ProcessedCount.class) when everything is OK.
In case of an error, i not only want to specify i change the HTTP status to some v4xx or 5xx, but also that i hcange the type of the returned content (say for instance, a OpenApiError.class wrapping an error code, a message and a description).
As i work with Java, and Swagger (spec 1.2), and spring mvc, i've tried to set these annotations :
@ApiOperation(value = "add a list of MSISDN", notes = "TODO", response = ProcessedCount.class)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully added"),
@ApiResponse(code = 416, message = "List is empty", response = OpenApiError.class) })
public ProcessedCount addMsisdn(@ApiParam(value = "list of ...", required = true) @RequestBody List<String> values) {
// ...
return new ProcessedCount(add);
}
I have also a Spring exception handler method that returns a ErrorDetail instance. Anyway ...
Question is : in swagger UI, here below is what i can see about my api responses
Error Status Codes
HTTP Status Code |
Reason |
200 |
MSISDN successfully added |
416 |
Posted MSISDN list is empty |
Thing is, i would really appreciate if swagger ui also indicates that, in case of a 416 status response, response body model will be a OpenApiError. Asfar as i can see, i don't see this information here.