Top Description Methods
org.eclipse.microprofile.openapi.annotations.parameters

public @Interface RequestBodySchema

extends Annotation
Annotations
@Target:PARAMETER, METHOD
@Retention:RUNTIME
@Inherited
Imports
java.lang.annotation.ElementType, .Inherited, .Retention, .RetentionPolicy, .Target

Provides a reference to a class that (after introspection) describes the schema for a single request body. This annotation provides a short-hand way to specify a simple request body that would otherwise be specified using @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();
}
See Also
RequestBody, OpenAPI Specification Request Body Object

Method Summary

Modifier and TypeMethod and Description
public Class<?>

Returns:

a class that implements this schema
value
()

Provides a Java class as implementation for this schema.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public Class<?> value()

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 request body model.

Returns:Class<?>

a class that implements this schema