You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With task "Extend BookRestController", the attendees are supposed to add a new mapping, so that the following mappings are present in the BookRestController afterwards:
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.
The text was updated successfully, but these errors were encountered:
Yes, this is correct. BookRestController doesn't comply withe the OpenAPI specification. However, adding another path probably would make the code more complex.
Could you maybe provide a pull request implementing the structure you have in mind?
Ich antworte einfach mal in Deutsch 😄
Die "billigste" Lösung wäre wahrscheinlich, @RequestParam(required=false) zu verwenden. Dann darf man aber auch keine Validatoren wie @NotNull oder @notblank verwenden.
BjoernKW
changed the title
Solution of "Extend BookRestController" not conform to OpenAPI Spec
Solution of "Extend BookRestController" doesn't comply with OpenAPI Spec
Apr 7, 2024
With task "Extend BookRestController", the attendees are supposed to add a new mapping, so that the following mappings are present in the
BookRestController
afterwards: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 oneBook
object. The operationgetAllBooks
returning multiple books does not appear anymore. (Attendees also ask every time whysearchBookByAuthor
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 movesearchBookByAuthor
to another path.The text was updated successfully, but these errors were encountered: