-
Notifications
You must be signed in to change notification settings - Fork 4
Description
With task "Extend BookRestController", the attendees are supposed to add a new mapping, so that the following mappings are present in the BookRestController afterwards:
@GetMapping
public List<Book> getAllBooks() {
// ...
}
@GetMapping("/{isbn}")
public Book getSingleBook(@PathVariable String isbn) throws Exception {
// ...
}
@GetMapping(params = "author")
public Book searchBookByAuthor(@RequestParam String author) throws Exception {
// ...
}This means that for GET requests with path "/book" there are 2 mappings available now. For Spring this is not a problem. But if we add Springdoc/Swagger later, it gives a weird result:

For "GET /book" we have only one operation where the query parameter author is required and which returns only one Book object. The operation getAllBooks returning multiple books does not appear anymore. (Attendees also ask every time why searchBookByAuthor returns only one book and not multiple.)
From my point of view, our BookRestController is no longer OpenAPI conform, because there only one operation may be defined per path and method, see Specification. I suggest to move searchBookByAuthor to another path.