Slide 11
Slide 11 text
Documentation d’API REST
11
implementation
'org.springdoc:springdoc-openapi-ui:1.5.8’
springdoc:
api-docs:
enabled: false
@Operation(summary = "Gets all books")
@ApiResponses(value = {
@ApiResponse(responseCode = "200",
description = "Found books",
content = {@Content(mediaType =
APPLICATION_JSON_VALUE,
schema =
@Schema(implementation = List.class))}),
@ApiResponse(responseCode = "204",
description = "No books found")})
@GetMapping
public ResponseEntity> getAllBooks() {
return
ResponseEntity.ok(bookService.findAllBooks());
}
# Enable Swagger UI for the test & prod modes
quarkus.swagger-ui.always-include=true
@Operation(summary = "Returns all the books from
the database")
@APIResponse(responseCode = "200",
content = @Content(mediaType =APPLICATION_JSON,
schema = @Schema(implementation =
Book.class,
type = SchemaType.ARRAY)))
@APIResponse(responseCode = "204", description =
"No books")
@GET
public Response getAllBooks() {
List books = service.findAllBooks();
return Response.ok(books).build();
}