1 package webapi;
2
3 import java.util.List;
4
5 import javax.ws.rs.GET;
6 import javax.ws.rs.Path;
7 import javax.ws.rs.Produces;
8 import javax.ws.rs.QueryParam;
9 import javax.ws.rs.core.MediaType;
10
11 import org.eclipse.microprofile.openapi.annotations.Operation;
12 import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
13 import org.eclipse.microprofile.openapi.annotations.media.Content;
14 import org.eclipse.microprofile.openapi.annotations.media.Schema;
15 import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
16 import org.eclipse.microprofile.openapi.annotations.parameters.Parameters;
17 import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
18
19
20
21
22
23
24 @Path("/products")
25 public interface ProcutEndPointSpec {
26
27 @GET
28 @Path("/pricecalc")
29 @Produces(MediaType.APPLICATION_JSON)
30 @Operation(
31 operationId = "calculatePrice",
32 summary = "会員価格を計算する",
33 description = "会員種別に応じた割引率を適用した価格を計算する")
34 @Parameters({
35 @Parameter(name = "memberNo", description = "会員番号。数値+大文字アルファベットのみ(一般会員はA0001,シルバー会員はA0002, ゴールド会員はA0003)",
36 required = true,
37 schema = @Schema(implementation = String.class, minLength = 5, maxLength = 5)),
38 @Parameter(name = "price", description = "価格", required = true,
39 schema = @Schema(implementation = Integer.class, minimum = "1", maximum = "99999999"))
40 })
41 @APIResponse(responseCode = "200",
42 description = "計算結果。1個目は割引後の価格、2個目は会員種別、3個目は割引率を格納",
43 content = @Content(mediaType = "application/json", schema =
44 @Schema(type = SchemaType.ARRAY, implementation = Integer.class, minItems = 3, maxItems = 3)))
45 List<Integer> calculatePrice(@QueryParam("memberNo") String memberNo, @QueryParam("price") int price);
46 }