O'Reilly logo

Hands-On Enterprise Java Microservices with Eclipse MicroProfile by Scott Stark, Antoine Sabot-Durand, Pavol Loffay, Jeff Mesnil, Heiko W. Rupp, Cesar Saavedra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Usage examples

Some usage examples of MicroProfile OpenAPI annotations are as follows:

Example 1 – Simple operation description (abbreviated):

@GET@Path("/findByMake")@Operation(summary = "Finds cars by make",           description = "Find cars by their manufacturer")public Response findCarsByMake(...){ ... }

The following is the output for example 1:

/car/findByMake:  get:    summary: Finds cars by make    description: Find cars by their manufacturer

Example 2 – Operation with different responses (abbreviated):

@GET@Path("/{name}")@Operation(summary = "Get customer by name")  @APIResponse(description = "The customer",             content = @Content(mediaType = "application/json",                                schema = @Schema(implementation = Customer.class))),@APIResponse(responseCode = "400", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required