@Target(value={PARAMETER,METHOD})
@Retention(value=RUNTIME)
@Inherited
public @interface RequestBodySchema
@RequestBody 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.
@RequestBody(content = { @Content(schema = @Schema(implementation = MyRequestObject.class)) })
@RequestBodySchema(MyRequestObject.class)
Any media types that apply to the resource method from either a method-level or class-level
@Consumes annotation will result in those media types applying to the OpenAPI request body model.
This annotation is useful in cases when a single request body schema applies to all media types (as given in
@Consumes), where it is not possible for class introspection to determine the schema directly.
@PUT
@Path("{id}")
@RequestBodySchema(MyRequestObject.class)
public Response updateItem(@PathParam("{id}") long id, InputStream rawData) {
MyRequestObject entity = service.deserialize(rawData);
service.persist(entity);
return Response.status(204).build();
}
RequestBody,
OpenAPI
requestBody Object| Modifier and Type | Required Element and Description |
|---|---|
java.lang.Class<?> |
value
Provides a Java class as implementation for this schema.
|