@Target(value=METHOD) @Retention(value=RUNTIME) @Inherited @Repeatable(value=APIResponses.class) public @interface APIResponse
When this annotation is applied to a method the response is added to the responses defined in the corresponding OpenAPI operation. If the operation already has a response with the specified responseCode the annotation on the method is ignored.
@ApiResponse(responseCode="200", description="Calculate load size", content= [ @Content(mediaType="application/json", Schema=@Schema(type="integer")) ] ) @GET public getLuggageWeight(Flight id) { return getBagWeight(id) + getCargoWeight(id); }
Modifier and Type | Optional Element and Description |
---|---|
Content[] |
content
An array containing descriptions of potential response payloads for different media types.
|
java.lang.String |
description
A short description of the response.
|
Header[] |
headers
An array of response headers.
|
Link[] |
links
An array of operation links that can be followed from the response.
|
java.lang.String |
name
The unique name to identify this response.
|
java.lang.String |
ref
Reference value to a Response object.
|
java.lang.String |
responseCode
The HTTP response code, or 'default', for the supplied response.
|
public abstract java.lang.String description
public abstract java.lang.String responseCode
public abstract Header[] headers
RFC7230 states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.
public abstract Link[] links
public abstract Content[] content
public abstract java.lang.String name
Components
. The name will
be used as the key to add this response to the 'responses' map for reuse.public abstract java.lang.String ref
This property provides a reference to an object defined elsewhere. This property and all other properties are mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined.