@APIResponse and that typically could not be
determined by scanning the resource method alone.
The following annotation usages are equivalent to the OpenAPI annotation scanner runtime.
@APIResponse(content = { @Content(schema = @Schema(implementation = MyResponseObject.class)) })
@APIResponseSchema(MyResponseObject.class)
When this annotation is applied to a method the response is added to the responses defined in the corresponding
OpenAPI operation with a default response code and description that correspond to the method's HTTP method annotation
and return type. Any media types that apply to the resource method from either a method-level or class-level
@Produces annotation will result in those media types applying to the OpenAPI response model.
If not specified, default responseCode and responseDescription values shall be determined according to the
responseCode and responseDescription documentation.
@GET
@Path("{id}")
@APIResponseSchema(value = MyResponseObject.class, responseDescription = "Success", responseCode = "200")
public Response getById(@PathParam("{id}") long id) {
MyResponseObject entity = service.load(id);
return Response.status(200).entity(entity).build();
}
APIResponse, OpenAPI Specification Response Object
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: HTTP response code for this response instance or defaultThe HTTP response code, or 'default', for the supplied response. |
| public String | |
| public Class | Returns: a class that implements this schemaProvides a Java class as implementation for this schema. |
| responseCode | back to summary |
|---|---|
| public String responseCode() The HTTP response code, or 'default', for the supplied response. May have only one 'default' entry. If no value is specified, a default shall be determined using REST conventions as follows:
| |
| responseDescription | back to summary |
|---|---|
| public String responseDescription() A short description of the response. It is a REQUIRED property in the OpenAPI document.
If no value is specified, the default value will set to the description given by the
HTTP/1.1 documentation for the
| |
| value | back to summary |
|---|---|
| public Class Provides a Java class as implementation for this schema. The class will undergo introspection to determine any applicable Schema attributes to be applied to the OpenAPI response model.
| |