Annotation Type RequestBodySchema
-
@Target({PARAMETER,METHOD}) @Retention(RUNTIME) @Inherited public @interface RequestBodySchema
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@RequestBodyand 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
@Consumesannotation 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 requestBody Object
-
-
Element Detail
-
value
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:
- a class that implements this schema
-
-