Skip to main content

Swagger Responses

Under the input parameters are listed the possible responses for the resource.

The 200 response is determined by the return type on the method, in this case a collection of Pet objects:

@RestGet(
path="/pet",
summary="All pets in the store",
...
)
public Collection getPets() throws NotAcceptable {
return store.getPets();
}

Note that additional responses can be specified by throwing exceptions annotated with the @Response annotation such as this one:

@Response
@StatusCode(406)
@Schema(description="Not Acceptable")
public class NotAcceptable extends BasicHttpException {...}

Like input parameters, the Swagger for responses can be define in multiple locations such as:

@Response annotated classes, methods, and parameters.@Rest(swagger) / @RestOp(swagger) annotations.