-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
622-ergaenzen-der-apiresponses-annotation-wahlvorbereitung-service #932
base: dev
Are you sure you want to change the base?
622-ergaenzen-der-apiresponses-annotation-wahlvorbereitung-service #932
Conversation
WalkthroughThe pull request updates the dependency configuration and enhances API documentation across several components. In the project's Maven configuration, the version for a common library is updated (from 1.2.0 to 1.4.0) and a new Swagger dependency is added. The Spring Boot application's package scanning is extended to include a Swagger-related package. Across multiple controller classes, the OpenAPI documentation is refined by adding explicit response annotations to the endpoint operations. These annotations now specify expected HTTP response codes (such as 200 and 201) along with their corresponding descriptions for both GET and POST methods. Additionally, any necessary import statements for these annotations are incorporated. ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/waehlerverzeichnis/WaehlerverzeichnisController.java (2)
45-51
: Document all possible response scenarios.The GET method can return either an OK response with a body or a NO_CONTENT response (204) as indicated by the
okWithBodyOrNoContent
method call on line 55. Consider documenting both possible response types.@Operation( description = "Angaben über das Wählerverzeichnis des Urnenwahllokals {wahlbezirkID}", responses = { @ApiResponse( responseCode = "200", description = "Wählerverzeichnis erfolgreich zurückgegeben." - ) } + ), + @ApiResponse( + responseCode = "204", description = "Kein Wählerverzeichnis für den angegebenen Wahlbezirk und die Wählerverzeichnisnummer gefunden." + ) + } )
32-51
: Consider documenting potential error responses.Both methods only document successful responses but don't document potential error responses (e.g., 400 for invalid input, 404 for resource not found, 500 for server errors). Consider adding these to provide comprehensive API documentation.
Example for additional API responses:
@ApiResponse(responseCode = "400", description = "Ungültige Eingabe oder Format."), @ApiResponse(responseCode = "404", description = "Wahlbezirk oder Wählerverzeichnis nicht gefunden."), @ApiResponse(responseCode = "500", description = "Serverfehler bei der Verarbeitung der Anfrage.")
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
wls-wahlvorbereitung-service/pom.xml
(2 hunks)wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/MicroServiceApplication.java
(1 hunks)wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/briefwahlvorbereitung/BriefwahlvorbereitungController.java
(2 hunks)wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/eroeffnungsuhrzeit/EroeffnungsUhrzeitController.java
(2 hunks)wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/fortsetzungsuhrzeit/FortsetzungsUhrzeitController.java
(2 hunks)wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/unterbrechungsuhrzeit/UnterbrechungsUhrzeitController.java
(2 hunks)wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/urnenwahlschliessungsuhrzeit/UrnenwahlSchliessungsUhrzeitController.java
(2 hunks)wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/urnenwahlvorbereitung/UrnenwahlvorbereitungController.java
(2 hunks)wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/waehlerverzeichnis/WaehlerverzeichnisController.java
(3 hunks)
🔇 Additional comments (21)
wls-wahlvorbereitung-service/pom.xml (2)
40-40
: LGTM: Dependency version updateThe version update for
wls.common.version
from 1.2.0 to 1.4.0 looks good as it enables access to the latest features and improvements.
165-169
: LGTM: Added Swagger dependencyThis addition of the Swagger dependency from the wls-common library aligns well with the PR objective of adding a default configuration for Swagger to enhance API documentation.
wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/MicroServiceApplication.java (1)
31-32
: LGTM: Added Swagger package to component scanningThe inclusion of the swagger package in scanBasePackages is necessary to enable the Spring component scanning to detect the swagger configuration classes from the newly added dependency.
wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/fortsetzungsuhrzeit/FortsetzungsUhrzeitController.java (3)
6-6
: LGTM: Added import for ApiResponseAdded the necessary import for the ApiResponse annotation used in the OpenAPI documentation.
27-33
: LGTM: Enhanced API documentationAdded proper OpenAPI response documentation for the GET endpoint, clearly specifying the expected HTTP 200 response code and description.
41-47
: LGTM: Enhanced API documentationAdded proper OpenAPI response documentation for the POST endpoint, clearly specifying the expected HTTP 201 response code and description.
wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/eroeffnungsuhrzeit/EroeffnungsUhrzeitController.java (2)
6-6
: LGTM: Added import for ApiResponseAdded the necessary import for the ApiResponse annotation used in the OpenAPI documentation.
27-33
: LGTM: Enhanced API documentationAdded proper OpenAPI response documentation for the GET endpoint, clearly specifying the expected HTTP 200 response code and description.
wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/unterbrechungsuhrzeit/UnterbrechungsUhrzeitController.java (3)
6-6
: Added necessary import for API response documentation.The import for
ApiResponse
from the OpenAPI annotations is required for the response documentation that has been added to the operations.
27-33
: Improved API documentation with response specifications.The
@Operation
annotation has been enhanced with proper response documentation, specifying a 200 status code and description for successful retrieval of the interruption time. This improves the OpenAPI documentation and makes the API behavior more transparent to consumers.
41-47
: Completed API documentation with response specifications.The POST operation now correctly specifies the 201 status code with an appropriate description, which aligns with the actual implementation (see
@ResponseStatus(HttpStatus.CREATED)
at line 49). This makes the API contract clearer and more consistent.wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/urnenwahlvorbereitung/UrnenwahlvorbereitungController.java (3)
6-6
: Added necessary import for API response documentation.The import for
ApiResponse
from the OpenAPI annotations is required for the response documentation that has been added to the operations.
27-33
: Enhanced API documentation with response specifications.The GET operation now properly documents the 200 response code with a clear description, improving the OpenAPI/Swagger documentation and making the API behavior more transparent to consumers.
41-47
: Completed API documentation with appropriate response code.The POST operation now correctly documents the 201 status code with a descriptive message, which matches the actual implementation (see
@ResponseStatus(HttpStatus.CREATED)
at line 49). This improves the API contract clarity.wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/urnenwahlschliessungsuhrzeit/UrnenwahlSchliessungsUhrzeitController.java (3)
6-6
: Added necessary import for API response documentation.The import for
ApiResponse
annotation is required for the response documentation that has been added to the operations.
27-33
: Improved API documentation with response specifications.The GET operation now properly documents the 200 response code with a descriptive message, enhancing the OpenAPI/Swagger documentation for this endpoint.
41-47
: Enhanced API documentation with proper response code.The POST operation now correctly specifies the 201 status code with an appropriate description, matching the implementation's
@ResponseStatus(HttpStatus.CREATED)
at line 49. This ensures consistency between the documented and actual behavior.wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/briefwahlvorbereitung/BriefwahlvorbereitungController.java (3)
6-6
: Added necessary import for API response documentation.The import for
ApiResponse
from the OpenAPI annotations package is required for the response documentation that has been added to the operations.
27-33
: Enhanced API documentation with response specifications.The GET operation now properly documents the 200 response code with a clear description, improving the OpenAPI/Swagger documentation and making the API behavior more transparent to consumers.
41-47
: Completed API documentation with appropriate response code.The POST operation now correctly specifies the 201 status code with a descriptive message, matching the implementation's
@ResponseStatus(HttpStatus.CREATED)
at line 49. This ensures consistency between the documented and actual behavior.wls-wahlvorbereitung-service/src/main/java/de/muenchen/oss/wahllokalsystem/wahlvorbereitungservice/rest/waehlerverzeichnis/WaehlerverzeichnisController.java (1)
7-7
: Appropriate import for API response documentation.The import for
ApiResponse
annotation is correctly added to support the OpenAPI documentation for endpoint responses.
@Operation( | ||
description = "Aktualisiert die Eroeffnungsuhrzeit des Wahllokals {wahlbezirkID}", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "201", description = "Fortsetzungsuhrzeit erfolgreich gespeichert." | ||
) } | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect API response description
The response description for the POST endpoint incorrectly references "Fortsetzungsuhrzeit" instead of "Eroeffnungsuhrzeit".
Apply this diff to fix the description:
- responseCode = "201", description = "Fortsetzungsuhrzeit erfolgreich gespeichert."
+ responseCode = "201", description = "Eroeffnungsuhrzeit erfolgreich gespeichert."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
@Operation( | |
description = "Aktualisiert die Eroeffnungsuhrzeit des Wahllokals {wahlbezirkID}", | |
responses = { | |
@ApiResponse( | |
responseCode = "201", description = "Fortsetzungsuhrzeit erfolgreich gespeichert." | |
) } | |
) | |
@Operation( | |
description = "Aktualisiert die Eroeffnungsuhrzeit des Wahllokals {wahlbezirkID}", | |
responses = { | |
@ApiResponse( | |
responseCode = "201", description = "Eroeffnungsuhrzeit erfolgreich gespeichert." | |
) } | |
) |
description = "Speichern der Angaben über das Wählerverzeichnis des Urnenwahllokals {wahlbezirkID}. Wird je aktivem Wählerverzeichnis einmal gespeichert und per wvzNummer dem jeweiligen zugeordnet.", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "200", description = "Angaben über das Wählerverzeichnis des Urnenwahllokals erfolgreich gespeichert." | ||
) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API response code mismatch with actual endpoint behavior.
There's an inconsistency between the documented response code and the actual behavior of the endpoint. The method is annotated with @ResponseStatus(HttpStatus.CREATED)
on line 30, indicating a 201 status code, but the API documentation specifies a 200 response code.
@Operation(
description = "Speichern der Angaben über das Wählerverzeichnis des Urnenwahllokals {wahlbezirkID}. Wird je aktivem Wählerverzeichnis einmal gespeichert und per wvzNummer dem jeweiligen zugeordnet.",
responses = {
@ApiResponse(
- responseCode = "200", description = "Angaben über das Wählerverzeichnis des Urnenwahllokals erfolgreich gespeichert."
+ responseCode = "201", description = "Angaben über das Wählerverzeichnis des Urnenwahllokals erfolgreich gespeichert."
) }
)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
description = "Speichern der Angaben über das Wählerverzeichnis des Urnenwahllokals {wahlbezirkID}. Wird je aktivem Wählerverzeichnis einmal gespeichert und per wvzNummer dem jeweiligen zugeordnet.", | |
responses = { | |
@ApiResponse( | |
responseCode = "200", description = "Angaben über das Wählerverzeichnis des Urnenwahllokals erfolgreich gespeichert." | |
) } | |
@Operation( | |
description = "Speichern der Angaben über das Wählerverzeichnis des Urnenwahllokals {wahlbezirkID}. Wird je aktivem Wählerverzeichnis einmal gespeichert und per wvzNummer dem jeweiligen zugeordnet.", | |
responses = { | |
@ApiResponse( | |
responseCode = "201", description = "Angaben über das Wählerverzeichnis des Urnenwahllokals erfolgreich gespeichert." | |
) } | |
) |
Beschreibung:
Definition of Done (DoD):
Backend
Referenzen1:
Verwandt mit Issue #622
Closes #
Summary by CodeRabbit
Chores
Documentation
Footnotes
Nicht zutreffende Referenzen vor dem Speichern entfernen ↩