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

chore(sdk): Add doc #1975

Merged
merged 2 commits into from
Feb 27, 2025
Merged

chore(sdk): Add doc #1975

merged 2 commits into from
Feb 27, 2025

Conversation

MagnusSandgren
Copy link
Collaborator

No description provided.

@MagnusSandgren MagnusSandgren requested a review from a team as a code owner February 27, 2025 10:43
Copy link
Contributor

coderabbitai bot commented Feb 27, 2025

📝 Walkthrough

Walkthrough

This pull request introduces detailed XML documentation comments for the IDialogTokenValidator interface, the DialogTokenValidationParameters class, and the IValidationResult interface, enhancing the clarity of method parameters and expected behaviors during token validation. Additionally, the README.md has been updated with expanded installation instructions, usage examples, configuration details, a new section on available services, and background service functionality for fetching the public key from the Dialogporten API.

Changes

File Change Summary
src/Digdir.Library.Dialogporten.WebApiClient/…/IDialogTokenValidator.cs Added XML documentation for IDialogTokenValidator, including a summary for the Validate method; introduced DialogTokenValidationParameters class with properties (Default, ValidateLifetime, ClockSkew); added IValidationResult interface with properties (IsValid, Errors, ClaimsPrincipal).
src/Digdir.Library.Dialogporten.WebApiClient/README.md Enhanced installation and usage instructions; updated configuration examples for DialogportenSettings; detailed registration methods with code examples; added a new "Available services" section and outlined the background service (IHostedService) for fetching the Dialogporten API public key.

Possibly related PRs

  • chore: enrich validator api #1958: Enhancements in the validator API adding support for dialog IDs and required actions are closely related.
  • feat: dialogtoken validator return claims #1931: The changes in this PR enhance the documentation and structure of the IDialogTokenValidator interface and related classes, which connects directly to modifications in this retrieved PR that also involve IValidationResult interface handling.

Suggested reviewers

  • Fargekritt

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

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 (3)
src/Digdir.Library.Dialogporten.WebApiClient/README.md (3)

11-19: Helpful installation instructions, but missing language specifiers in code blocks.

The installation instructions are clear and provide good options for both Package Manager Console and .NET Core CLI, but the code blocks should specify a language for better syntax highlighting.

-```
+```powershell
-```
+```bash
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

12-12: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


17-17: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


22-29: Good configuration documentation, minor grammar issue.

Clear explanation of configuration requirements. However, there's a small grammar issue on line 24.

-The client will throw an exception if the public key fetch fails on startup. Default true.
+The client will throw an exception if the public key fetch fails on startup. Default is true.
🧰 Tools
🪛 LanguageTool

[grammar] ~24-~24: “Key” is a singular noun. It appears that the verb form is incorrect.
Context: ...ll throw an exception if the public key fetch fails on startup. Default true. - `Mas...

(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)


31-70: Clear registration examples, but headings have trailing punctuation.

The registration examples are comprehensive and provide good guidance, but the headings contain trailing punctuation that should be removed according to markdown standards.

-#### Register through [action parameter](https://learn.microsoft.com/en-us/dotnet/core/extensions/options-library-authors#actiontoptions-parameter):
+#### Register through [action parameter](https://learn.microsoft.com/en-us/dotnet/core/extensions/options-library-authors#actiontoptions-parameter)
-#### Register through [options instance parameter](https://learn.microsoft.com/en-us/dotnet/core/extensions/options-library-authors#options-instance-parameter):
+#### Register through [options instance parameter](https://learn.microsoft.com/en-us/dotnet/core/extensions/options-library-authors#options-instance-parameter)
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

34-34: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


48-48: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 15abbd8 and 49919eb.

📒 Files selected for processing (2)
  • src/Digdir.Library.Dialogporten.WebApiClient/IDialogTokenValidator.cs (1 hunks)
  • src/Digdir.Library.Dialogporten.WebApiClient/README.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
src/Digdir.Library.Dialogporten.WebApiClient/README.md

[grammar] ~24-~24: “Key” is a singular noun. It appears that the verb form is incorrect.
Context: ...ll throw an exception if the public key fetch fails on startup. Default true. - `Mas...

(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)

🪛 markdownlint-cli2 (0.17.2)
src/Digdir.Library.Dialogporten.WebApiClient/README.md

12-12: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


17-17: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


34-34: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


48-48: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Dry run deploy apps / Deploy job sync-resource-policy-information-job to test
  • GitHub Check: Dry run deploy apps / Deploy job sync-subject-resource-mappings-job to test
🔇 Additional comments (4)
src/Digdir.Library.Dialogporten.WebApiClient/README.md (1)

72-77: Great addition of available services section.

This section provides valuable information about available services and the background service, which is essential for users to understand what's available after registration.

src/Digdir.Library.Dialogporten.WebApiClient/IDialogTokenValidator.cs (3)

6-23: Excellent documentation for IDialogTokenValidator.

The XML documentation for the interface and its Validate method is comprehensive and clearly describes the purpose, parameters, and return values.


25-50: Well-documented DialogTokenValidationParameters class.

The documentation for this class and its properties is clear and informative. The explanation of the Default property and how it can be altered to change global defaults is particularly helpful.


52-75: Thorough documentation for IValidationResult.

The XML documentation for the IValidationResult interface and its properties clearly explains the validation result structure. The remarks on ClaimsPrincipal are particularly valuable for understanding null conditions.

oskogstad
oskogstad previously approved these changes Feb 27, 2025
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 (6)
src/Digdir.Library.Dialogporten.WebApiClient/README.md (6)

11-14: Specify language for fenced code block
The fenced code block for the Package Manager Console command does not specify a language. Adding a language (e.g., powershell or bash) will improve syntax highlighting and maintain consistency.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

12-12: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


16-19: Specify language for CLI command block
The fenced code block for the .NET Core CLI command currently lacks a language specification. Consider adding one (for example, bash) to enhance readability.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

17-17: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


24-24: Clarify default value description
On the ThrowOnPublicKeyFetchInit setting, consider revising “Default true” to “Defaults to true” or “Default is true” for improved clarity and grammatical correctness.

🧰 Tools
🪛 LanguageTool

[grammar] ~24-~24: “Key” is a singular noun. It appears that the verb form is incorrect.
Context: ...ll throw an exception if the public key fetch fails on startup. Default true. - `Mas...

(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)


34-34: Remove trailing punctuation in heading
The heading “#### Register through action parameter:” ends with a colon. Removing the trailing punctuation would align it with markdown style guidelines.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

34-34: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


36-46: Ensure completeness of code snippet
The example for registering with IServiceCollection using the action parameter would be clearer if the lambda expression were complete—for instance, by including a closing parenthesis and semicolon after the lambda block. This helps prevent any potential confusion when users copy the code.


48-48: Remove trailing punctuation in heading
Similarly, the heading “#### Register through options instance parameter:” should have the trailing colon removed to comply with markdown best practices.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

48-48: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 49919eb and 3f0e41f.

📒 Files selected for processing (1)
  • src/Digdir.Library.Dialogporten.WebApiClient/README.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
src/Digdir.Library.Dialogporten.WebApiClient/README.md

[grammar] ~24-~24: “Key” is a singular noun. It appears that the verb form is incorrect.
Context: ...ll throw an exception if the public key fetch fails on startup. Default true. - `Mas...

(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)

🪛 markdownlint-cli2 (0.17.2)
src/Digdir.Library.Dialogporten.WebApiClient/README.md

12-12: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


17-17: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


34-34: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


48-48: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Dry run deploy apps / Deploy job sync-resource-policy-information-job to test
  • GitHub Check: Dry run deploy apps / Deploy job sync-subject-resource-mappings-job to test
  • GitHub Check: build / build-and-test

@MagnusSandgren MagnusSandgren merged commit 37c9130 into main Feb 27, 2025
23 checks passed
@MagnusSandgren MagnusSandgren deleted the chore/add-doc-to-sdk branch February 27, 2025 11:27
oskogstad pushed a commit that referenced this pull request Feb 28, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.57.0](v1.56.1...v1.57.0)
(2025-02-28)


### Features

* Add reverse indexes on Localizations and SearchTags
([#1971](#1971))
([7a506b3](7a506b3))
* **ci:** Enable PostreSQL extension pg_trgm
([#1984](#1984))
([4dce375](4dce375))


### Miscellaneous Chores

* **sdk:** Add doc
([#1975](#1975))
([37c9130](37c9130))

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