Skip to content

Conversation

@alexeyzimarev
Copy link
Member

@alexeyzimarev alexeyzimarev commented Nov 28, 2025

User description

Add missing README.md to the DI package and add one more extension


Auto-created Ticket

#2321

PR Type

Enhancement, Documentation


Description

  • Add new AddRestClient extension method accepting ConfigureRestClient delegate

  • Create comprehensive README.md for DI package with usage examples

  • Configure README.md to be included in NuGet package


Diagram Walkthrough

flowchart LR
  A["ServiceCollectionExtensions"] -->|"Add new overload"| B["AddRestClient<br/>ConfigureRestClient"]
  C["README.md"] -->|"Document usage"| D["DI Integration Guide"]
  E["Project File"] -->|"Include in package"| C
Loading

File Walkthrough

Relevant files
Enhancement
ServiceCollectionExtensions.cs
Add ConfigureRestClient delegate extension method               

src/RestSharp.Extensions.DependencyInjection/ServiceCollectionExtensions.cs

  • Add new AddRestClient method overload that accepts ConfigureRestClient
    delegate parameter
  • Method provides alternative way to configure RestClient with custom
    options
  • Includes XML documentation and [PublicAPI] attribute for consistency
+10/-0   
Documentation
README.md
Add comprehensive DI package documentation                             

src/RestSharp.Extensions.DependencyInjection/README.md

  • Create new README.md documenting the DI package purpose and features
  • Provide code examples for default client, base URL, and custom options
    registration
  • Document named client registration and resolution using
    IRestClientFactory
  • Explain how to inject IRestClient into classes
+45/-0   
Configuration changes
RestSharp.Extensions.DependencyInjection.csproj
Configure README inclusion in NuGet package                           

src/RestSharp.Extensions.DependencyInjection/RestSharp.Extensions.DependencyInjection.csproj

  • Add ItemGroup configuration to include README.md in NuGet package
  • Set Pack to true and PackagePath to root directory for package
    distribution
+6/-0     

@qodo-merge-for-open-source
Copy link
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
🟢
No codebase code duplication found No new components were introduced in the PR code
Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@cloudflare-workers-and-pages
Copy link

Deploying restsharp with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0e76149
Status: ✅  Deploy successful!
Preview URL: https://d60f8c1a.restsharp.pages.dev
Branch Preview URL: https://di-improvements.restsharp.pages.dev

View logs

@alexeyzimarev alexeyzimarev merged commit fef121c into dev Nov 28, 2025
10 checks passed
@alexeyzimarev alexeyzimarev deleted the di-improvements branch November 28, 2025 13:08
@qodo-merge-for-open-source
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Simplify overload by calling core method

To improve clarity, explicitly pass null for the optional configureSerialization
parameter when calling the AddRestClient overload.

src/RestSharp.Extensions.DependencyInjection/ServiceCollectionExtensions.cs [85-88]

 public void AddRestClient(ConfigureRestClient configureRestClient) {
     Ensure.NotNull(configureRestClient, nameof(configureRestClient));
-    services.AddRestClient(Constants.DefaultRestClient, configureRestClient);
+    services.AddRestClient(Constants.DefaultRestClient, configureRestClient, null);
 }
  • Apply / Chat
Suggestion importance[1-10]: 2

__

Why: The suggestion's reasoning is flawed as there is no extra layer of indirection; however, explicitly passing null for the optional parameter can be seen as a minor improvement for code clarity.

Low
  • More

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.

2 participants