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

fix(webapi): Add missing status codes in swagger docs for transmissions endpoints #1926

Merged

Conversation

oskogstad
Copy link
Collaborator

No description provided.

@oskogstad oskogstad requested a review from a team as a code owner February 20, 2025 14:23
Copy link
Contributor

coderabbitai bot commented Feb 20, 2025

📝 Walkthrough

Walkthrough

This pull request updates API documentation and implementation for dialog transmission endpoints. Changes include adding and refining response codes (404 and 410) with clearer descriptions for both enduser and service owner endpoints. Additionally, constant strings and client interface documentation have been streamlined to reflect these modifications. The updates span the OpenAPI specification file, endpoint implementation files, and associated summary files, ensuring consistent error handling messaging across the API.

Changes

File(s) Change Summary
docs/schema/V1/swagger.verified.json Modified OpenAPI spec: added/updated 404 and 410 response codes with clear descriptions for dialog transmissions endpoints.
src/Digdir.../Common/Constants.cs Updated the DialogTransmissionNotFound constant to simplify and clarify the 404 error message.
src/Digdir.../Endpoints/V1/EndUser/DialogTransmissions/Get/*.cs Enhanced GET endpoints to include 410 Gone response handling and updated response descriptions in both implementation and summary classes.
src/Digdir.../Endpoints/V1/EndUser/DialogTransmissions/Search/*.cs Configured search endpoints to support 410 Gone responses with updated API documentation and new using directive.
src/Digdir.../WebApiClient/Features/V1/RefitterInterface.cs Updated client API documentation for 404 status to reflect the simplified error message.

Possibly related PRs

Suggested reviewers

  • arealmaas
  • MagnusSandgren

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7507187 and b622927.

📒 Files selected for processing (7)
  • docs/schema/V1/swagger.verified.json (3 hunks)
  • src/Digdir.Domain.Dialogporten.WebApi/Common/Constants.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/EndUser/DialogTransmissions/Get/GetDialogTransmissionEndpoint.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/EndUser/DialogTransmissions/Get/GetDialogTransmissionEndpointSummary.cs (1 hunks)
  • src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/EndUser/DialogTransmissions/Search/SearchDialogTransmissionEndpoint.cs (2 hunks)
  • src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/EndUser/DialogTransmissions/Search/SearchDialogTransmissionEndpointSummary.cs (1 hunks)
  • src/Digdir.Library.Dialogporten.WebApiClient/Features/V1/RefitterInterface.cs (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/Digdir.Library.Dialogporten.WebApiClient/Features/V1/RefitterInterface.cs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Dry run deploy apps / Deploy service to test
  • GitHub Check: Dry run deploy apps / Deploy web-api-so to test
  • GitHub Check: Dry run deploy apps / Deploy web-api-eu to test
  • GitHub Check: build / build-and-test
🔇 Additional comments (8)
src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/EndUser/DialogTransmissions/Get/GetDialogTransmissionEndpointSummary.cs (1)

20-20: LGTM! Good addition of the 410 Gone status code.

The addition of the 410 Gone status code with the appropriate message is a good practice for indicating that a dialog has been deleted.

src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/EndUser/DialogTransmissions/Search/SearchDialogTransmissionEndpointSummary.cs (1)

21-21: LGTM! Good addition of the 410 Gone status code.

The addition of the 410 Gone status code with the appropriate message is a good practice for indicating that a dialog has been deleted.

src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/EndUser/DialogTransmissions/Get/GetDialogTransmissionEndpoint.cs (1)

27-27: LGTM! Good addition of the 410 Gone status code to the API description.

The addition of the 410 Gone status code to the ProducesOneOf description properly documents the existing response handling for deleted resources.

src/Digdir.Domain.Dialogporten.WebApi/Endpoints/V1/EndUser/DialogTransmissions/Search/SearchDialogTransmissionEndpoint.cs (1)

4-4: LGTM! Good addition of the 410 Gone status code to the API description.

The addition of the Common.Extensions namespace and the ProducesOneOf description with 410 Gone status code properly documents the existing response handling for deleted resources.

Also applies to: 25-28

src/Digdir.Domain.Dialogporten.WebApi/Common/Constants.cs (1)

25-25: Great improvement to the error message!

The updated message is more concise and clearer, while maintaining consistency with similar error messages in the codebase. The removal of redundant information and the use of more formal API documentation style enhances the overall quality of the swagger docs.

docs/schema/V1/swagger.verified.json (3)

5622-5635: Added missing response codes and descriptions for dialog transmissions endpoint.

The endpoint GET /api/v1/enduser/dialogs/{dialogId}/transmissions has been updated to include:

  • 404 response with description "The given dialog ID was not found."
  • 410 response with description "Entity with the given key(s) is removed."

These additions improve the API documentation by clearly specifying error scenarios.


7287-7288: Updated error description for transmission not found.

The error description for the 404 response in GET /api/v1/serviceowner/dialogs/{dialogId}/transmissions/{transmissionId} has been updated to be more specific: "The specified dialog ID or transmission ID was not found."

This change improves clarity by indicating that either the dialog ID or transmission ID could be the cause of the 404 error.


1-7310:

❓ Verification inconclusive

Verify API documentation consistency.

Let's verify that the error response descriptions are consistent across all endpoints that deal with dialog transmissions.


🏁 Script executed:

#!/bin/bash
# Description: Check consistency of error descriptions for transmission endpoints
# Expected: All transmission endpoints should have consistent error descriptions for 404 and 410 responses

# Search for transmission endpoints and their error descriptions
rg -A 5 '"description": "(The specified dialog ID or transmission ID was not found|The given dialog ID was not found|Entity with the given key\(s\) is removed)"'

Length of output: 163


Action Required: Manually Verify Transmission Error Descriptions

The automated check for consistency in the 404 and 410 error response descriptions for transmission endpoints produced no output. This may indicate that the error texts are not matching the expected patterns or are defined differently. Please manually review the Swagger documentation file at docs/schema/V1/swagger.verified.json and verify that:

  • For 404 responses in transmission endpoints, the description is consistently either “The specified dialog ID or transmission ID was not found” or “The given dialog ID was not found.”
  • For 410 responses, the description is consistently “Entity with the given key(s) is removed.”

Once you confirm that these messages are applied consistently across all transmission endpoints, you may proceed accordingly.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai 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.

@oskogstad oskogstad merged commit 2458d6a into main Feb 20, 2025
23 checks passed
@oskogstad oskogstad deleted the fix/add-missing-status-codes-on-transmissions-endpoints branch February 20, 2025 14:28
oskogstad pushed a commit that referenced this pull request Feb 20, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.55.0](v1.54.0...v1.55.0)
(2025-02-20)


### Features

* **webapi:** Add flag for disabling SystemLabel reset
([#1921](#1921))
([a5689f2](a5689f2))


### Bug Fixes

* **webapi:** Add missing 404 status code in activity list swagger
schema ([#1924](#1924))
([8f382cd](8f382cd))
* **webapi:** Add missing status codes in swagger docs for transmissions
endpoints ([#1926](#1926))
([2458d6a](2458d6a))


### Miscellaneous Chores

* **ci:** Releasing NuGet depends on app-deploy
([#1920](#1920))
([37f9990](37f9990))
* **ci:** Use correct project path for NuGet publishing
([#1925](#1925))
([7507187](7507187))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants