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:
@RestMethod(
name=GET,
path="/pet",
summary="All pets in the store",
...
)
public Collection<Pet> getPets() throws NotAcceptable {
return store.getPets();
}
Note that additional responses can be specified by throwing exceptions annotated with the {@link oaj.http.annotation.Response @Response} annotation such
as this one:
@Response(code=406, description="Not Acceptable")
public class NotAcceptable extends RestException {...}
Like input parameters, the Swagger for responses can be define in multiple locations such as:
- {@link oaj.http.annotation.Response @Response} annotated classes, methods, and parameters.
- {@link oajr.annotation.Rest#swagger() @Rest(swagger)} / {@link oajr.annotation.RestMethod#swagger() @RestMethod(swagger)} annotations.
- {@doc RestResponseAnnotation}
- {@doc RestResponseHeaderAnnotation}
- {@doc RestResponseStatusAnnotation}