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

feat(webapi): Add ExternalReference to dialog search result #1384

Merged
merged 4 commits into from
Nov 4, 2024

Conversation

oskogstad
Copy link
Collaborator

@oskogstad oskogstad commented Nov 3, 2024

Description

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Documentation

  • Documentation is updated (either in docs-directory, Altinnpedia or a separate linked PR in altinn-studio-docs., if applicable)

Summary by CodeRabbit

  • New Features
    • Introduced an externalReference property in the dialog schema, enhancing metadata for better integration with external systems.
    • Added an ExternalReference property in the DialogDtoBase class for service-specific references to external systems.

@oskogstad oskogstad requested a review from a team as a code owner November 3, 2024 18:57
Copy link
Contributor

coderabbitai bot commented Nov 3, 2024

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request introduces a new property, externalReference, to the V1ServiceOwnerDialogsQueriesSearch_Dialog schema in the OpenAPI specification and the DialogDtoBase class. This property is defined as a nullable string, intended to provide a service-specific reference to an external system or service. The changes enhance the metadata associated with dialogs without altering existing properties or structures.

Changes

File Path Change Summary
docs/schema/V1/swagger.verified.json Added externalReference property (nullable string) to V1ServiceOwnerDialogsQueriesSearch_Dialog and V1EndUserDialogsQueriesSearch_Dialog schemas.
src/Digdir.Domain.Dialogporten.Application/Features/V1/ServiceOwner/Dialogs/Queries/Search/DialogDtoBase.cs Added public string? ExternalReference { get; set; } property to DialogDtoBase class.
src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/DialogDtoBase.cs Added public string? ExternalReference { get; set; } property to DialogDtoBase class.

Possibly related issues

Possibly related PRs


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 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.

MagnusSandgren
MagnusSandgren previously approved these changes Nov 4, 2024
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

🧹 Outside diff range and nitpick comments (1)
src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/DialogDtoBase.cs (1)

74-80: LGTM! Consider enhancing documentation with examples.

The implementation looks good - the property type, nullability, and placement are appropriate. The documentation clearly explains the purpose and follows the established pattern.

Consider adding an example value in the XML documentation to maintain consistency with other properties in the class:

 /// Arbitrary string with a service-specific reference to an external system or service.
 ///
 /// Refer to the service-specific documentation provided by the service owner for details (if in use).
+/// </summary>
+/// <example>case-2023-12345</example>
 /// </summary>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 37258a7 and 6986ac9.

📒 Files selected for processing (2)
  • docs/schema/V1/swagger.verified.json (3 hunks)
  • src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/DialogDtoBase.cs (1 hunks)
🔇 Additional comments (4)
src/Digdir.Domain.Dialogporten.Application/Features/V1/EndUser/Dialogs/Queries/Search/DialogDtoBase.cs (1)

74-80: Verify consistent implementation across DTOs.

Let's ensure the ExternalReference property is consistently implemented across all related DTOs.

✅ Verification successful

Based on the shell script results, I can now generate the final response as there's sufficient evidence to verify the implementation:

ExternalReference property is consistently implemented across the codebase

The property is properly implemented with:

  • Consistent nullable string type and XML documentation across all DTOs
  • Database migration support with consistent max length (255)
  • Proper validation in command validators
  • GraphQL and API integration
  • Search functionality support in both EndUser and ServiceOwner contexts
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent implementation of ExternalReference across DTOs
# and potential usage patterns

# Check implementation in other DTOs
echo "Checking ExternalReference implementation in DTOs:"
ast-grep --pattern 'class $_ {
  $$$
  public string? ExternalReference { get; set; }
  $$$
}'

# Check for any existing usage patterns
echo -e "\nChecking potential usage patterns:"
rg "ExternalReference" -A 2 -B 2

Length of output: 30134

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

1340-1344: LGTM! Well-documented property addition.

The externalReference property is properly defined with:

  • Appropriate type (nullable string)
  • Clear description indicating its purpose as a service-specific reference
  • Reference to service-specific documentation for implementation details

4360-4364: LGTM! Consistent property definition across schemas.

The externalReference property definition in the service owner schema matches the end user schema exactly, maintaining API consistency.


1340-1344: Verify complete integration of externalReference property.

Let's verify the property is properly integrated across all relevant schemas and endpoints.

Also applies to: 4360-4364

✅ Verification successful

Property integration verified across all relevant schemas

The externalReference property is properly integrated and consistently defined across all relevant dialog schemas:

  • Present in both EndUser and ServiceOwner dialog schemas
  • Consistent property definition with same type and nullability
  • Consistent description across all occurrences
  • Properly documented with service-specific usage notes
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify externalReference property integration across schemas
# Expected results: Property should be consistently defined in relevant dialog schemas

# Test 1: Check for externalReference property definitions
echo "Checking externalReference property definitions..."
rg -A 2 '"externalReference"\s*:\s*{' 

# Test 2: Check for consistent property description
echo "Checking property description consistency..."
rg -A 3 '"description":\s*"Arbitrary string with a service-specific reference to an external system or service'

# Test 3: Check for property usage in examples
echo "Checking property usage in examples..."
rg '"externalReference":\s*"[^"]*"'

Length of output: 3087


Script:

#!/bin/bash
# Let's try a different approach to verify the integration

# Check for externalReference property definitions with escaped braces
echo "Checking externalReference property definitions..."
rg -A 2 '"externalReference"' docs/schema/V1/swagger.verified.json

# Check schema references that might use this property
echo "Checking schema references..."
rg -A 1 '\$ref.*#.*Dialog' docs/schema/V1/swagger.verified.json

# Check example usage in the swagger file
echo "Checking examples containing externalReference..."
rg -C 5 '"example".*\{' docs/schema/V1/swagger.verified.json

Length of output: 21395


Script:

#!/bin/bash
# Let's check the specific dialog schemas and their structure

echo "Checking dialog schemas and their structure..."
rg -A 20 'V1EndUserDialogsQueriesSearch_Dialog|V1ServiceOwnerDialogsQueriesSearch_Dialog' docs/schema/V1/swagger.verified.json

echo "Checking if externalReference is consistently defined in these schemas..."
rg -B 5 -A 5 '"externalReference".*\{' docs/schema/V1/swagger.verified.json

Length of output: 23558

Copy link

sonarqubecloud bot commented Nov 4, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
58.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@oskogstad oskogstad merged commit 431fe16 into main Nov 4, 2024
22 of 23 checks passed
@oskogstad oskogstad deleted the feat/add-external-reference-to-dialog-search-result branch November 4, 2024 11:44
arealmaas added a commit that referenced this pull request Nov 5, 2024
🤖 I have created a release *beep* *boop*
---


##
[1.28.0](v1.27.1...v1.28.0)
(2024-11-05)


### Features

* update swagger name generation
([#1350](#1350))
([94c5544](94c5544))
* **webapi:** Add ExternalReference to dialog search result
([#1384](#1384))
([431fe16](431fe16))
* **webapi:** Return 410 GONE for notification checks on deleted dialogs
([#1387](#1387))
([198bebd](198bebd))


### Bug Fixes

* Add system user id to identifying claims
([#1362](#1362))
([16f160d](16f160d))
* **e2e:** Use pagination in sentinel
([#1372](#1372))
([a1df0ff](a1df0ff))
* fixed placement of referenced workflow-file
([#1365](#1365))
([49c1d80](49c1d80))
* workaround for github number error in dispatch workflow
([#1367](#1367))
([06ee356](06ee356))

---
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