Skip to content
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-basisdaten-service #924

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

DanielOber
Copy link
Contributor

@DanielOber DanielOber commented Mar 8, 2025

Beschreibung:

  • neue default config für swagger hinzugefügt
  • api-responses angepasst, falls nötig

Definition of Done (DoD):

Backend

  • Swagger-API vollständig

Referenzen1:

Verwandt mit Issue #622

Closes #

Summary by CodeRabbit

  • New Features

    • Integrated updated Swagger support to enhance API documentation and streamline the user view.
  • Documentation

    • Simplified API response messages across endpoints, ensuring consistent success indicators when retrieving or saving data such as manuals, election details, and templates.
    • Enhanced API documentation with clearer descriptions for successful responses across various controllers.

Footnotes

  1. Nicht zutreffende Referenzen vor dem Speichern entfernen

Copy link
Contributor

coderabbitai bot commented Mar 8, 2025

Walkthrough

The update modifies the project's dependency configuration and API documentation. In the Maven configuration, the version of the common library is upgraded from 1.3.0 to 1.4.0, and a new Swagger dependency is added. The main application class now includes an additional package for Swagger components during component scanning. Across several controllers, API response annotations have been updated: error response codes have been removed, and successful response codes (HTTP 200) with descriptive messages have been added or updated. These changes affect endpoints for managing handbooks, header data, referendum templates, invalid ballots, electoral districts, elections, election days, election timing, and election proposals. The modifications streamline the API documentation while leaving the core business logic unchanged.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 1e87f55 and 4a3ea54.

📒 Files selected for processing (11)
  • wls-basisdaten-service/pom.xml (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/MicroServiceApplication.java (1 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/handbuch/HandbuchController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/kopfdaten/KopfdatenController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/referendumvorlagen/ReferendumvorlagenController.java (1 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/ungueltigewahlscheine/UngueltigeWahlscheineController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahlbezirke/WahlbezirkeController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahlen/WahlenController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltag/WahltageController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltermindaten/WahltermindatenController.java (0 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahlvorschlag/WahlvorschlaegeController.java (1 hunks)
💤 Files with no reviewable changes (1)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltermindaten/WahltermindatenController.java

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or `` to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or `` anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/handbuch/HandbuchController.java (1)

65-65: API success response added for POST endpoint

Good addition of a 200 success response code with descriptive text. However, unlike the UngueltigeWahlscheineController, this endpoint no longer documents the 400 error response for invalid request parameters, despite the method still potentially throwing exceptions (line 75). Consider maintaining consistent error documentation across controllers.

@Operation(
        description = "Speichern eines Handbuches einer Wahl für eine bestimmte Wahlbezirksart",
        responses = {
                @ApiResponse(responseCode = "200", description = "Handbuch erfolgreich gespeichert"),
+               @ApiResponse(
+                       responseCode = "400", description = "Anfrageparameter sind fehlerhaft",
+                       content = @Content(mediaType = "application/json", schema = @Schema(implementation = WlsExceptionDTO.class))
+               )
        }
)
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e87f55 and 9be3eeb.

📒 Files selected for processing (11)
  • wls-basisdaten-service/pom.xml (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/MicroServiceApplication.java (1 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/handbuch/HandbuchController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/kopfdaten/KopfdatenController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/referendumvorlagen/ReferendumvorlagenController.java (1 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/ungueltigewahlscheine/UngueltigeWahlscheineController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahlbezirke/WahlbezirkeController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahlen/WahlenController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltag/WahltageController.java (2 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltermindaten/WahltermindatenController.java (0 hunks)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahlvorschlag/WahlvorschlaegeController.java (1 hunks)
💤 Files with no reviewable changes (1)
  • wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltermindaten/WahltermindatenController.java
🔇 Additional comments (16)
wls-basisdaten-service/pom.xml (2)

40-40: Dependency version update is properly aligned with new features.

The update to the wls.common version from 1.3.0 to 1.4.0 is appropriate to support the new Swagger functionality being implemented in this PR.


171-175: New Swagger dependency properly added.

The addition of the Swagger dependency from the wls-common library aligns with the PR objective of enhancing API documentation. This dependency will provide the necessary support for the Swagger functionality.

wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/MicroServiceApplication.java (1)

31-32: Appropriate component scan configuration for Swagger.

Adding the Swagger package to the component scan ensures that Spring will discover and register all Swagger-related components, which is necessary for the API documentation enhancement.

wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/kopfdaten/KopfdatenController.java (2)

6-6: Appropriate import for API documentation.

The addition of the ApiResponse import is necessary for the enhanced API documentation in the controller methods.


23-30: Improved API documentation with explicit response details.

The enhanced @operation annotation now includes a well-defined response specification with HTTP 200 status code and a descriptive message. This improves API documentation clarity and meets the PR objective of enhancing Swagger documentation.

wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahlvorschlag/WahlvorschlaegeController.java (1)

28-28: More descriptive API response documentation.

The response description has been updated from a generic "OK" to the more specific "Wahlvorschläge erfolgreich zurückgegeben." This improves API documentation by providing clearer context about the successful response.

wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/referendumvorlagen/ReferendumvorlagenController.java (1)

26-26: Good improvement to API documentation.

The updated description "Referendumvorlage erfolgreich zurückgegeben" provides more context about what a successful response means in this endpoint, which improves the API documentation.

wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahltag/WahltageController.java (2)

5-5: Good addition of import.

Adding the import for ApiResponse is required for the new annotations being added.


22-29: Good restructuring of @operation annotation with detailed response.

The updated multi-line format with explicit @ApiResponse annotation clearly documents the successful response for this endpoint. The description "Wahltage erfolgreich zurückgegeben" is informative and follows consistent naming patterns with other endpoints.

wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahlbezirke/WahlbezirkeController.java (2)

5-5: Appropriate import for API response annotations.

Adding the import for ApiResponse is necessary for the annotations being added below.


23-29: Good enhancement to API documentation.

The restructured @operation annotation with explicit @ApiResponse provides better documentation of the endpoint's behavior. The description "Wahlbezirke erfolgreich zurückgegeben" clearly indicates what a successful response means.

wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/wahlen/WahlenController.java (2)

37-37: Improved response description.

The updated description "Wahlen des Wahltags erfolgreich zurückgegeben" is more specific than the previous "OK" description, providing better context about what a successful response means for this endpoint.


51-51: Good documentation of success response.

The added API response description "Wahlen erfolgreich abgespeichert" clearly indicates what happens when the POST operation succeeds, which is helpful for API consumers.

wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/ungueltigewahlscheine/UngueltigeWahlscheineController.java (2)

48-50: API response documentation enhanced for GET endpoint

The addition of a proper success response code (200) with a clear description improves the API documentation for consumers. This aligns with the PR objective of enhancing Swagger documentation.


68-68: API success response added for POST endpoint

Good addition of a 200 success response code with clear description. Note that this endpoint still maintains the 400 error response (lines 69-72), which provides helpful context for API consumers when validation errors occur.

wls-basisdaten-service/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/handbuch/HandbuchController.java (1)

47-50: API success response added for GET endpoint

The addition of the 200 response code with a clear description enhances the Swagger documentation for API consumers. This is consistent with the changes in other controllers and aligns with the PR objectives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant