Skip to content

Add error handling, improved path logic, and tests for settings file generation#861

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/sub-pr-859-again
Draft

Add error handling, improved path logic, and tests for settings file generation#861
Copilot wants to merge 2 commits intomainfrom
copilot/sub-pr-859-again

Conversation

Copy link
Contributor

Copilot AI commented Dec 25, 2025

Description:

Addresses code review feedback from PR #859 by hardening the settings file generation feature with proper error handling, fixing edge cases in path determination, and adding comprehensive test coverage.

Changes

Error Handling

  • Wrapped file system operations in try-catch with specific exception types (IOException, UnauthorizedAccessException, SecurityException, NotSupportedException)
  • Throws descriptive InvalidOperationException with inner exception when settings file write fails

Path Determination Logic

  • Fixed DetermineSettingsFilePath to handle file paths with extensions in multi-file mode
  • Added Path.HasExtension check to properly extract directory from file paths
  • Ensures consistent .refitter file placement across single-file and multi-file generation modes

Test Coverage

  • Added SettingsFileGenerationTests with 5 test methods covering:
    • Settings serialization/deserialization
    • Directory creation
    • Filesystem error handling
    • Path logic for file extensions in multi-file scenarios

Documentation

  • Updated misleading comment to accurately describe path determination behavior

Example OpenAPI Specifications:

openapi: '3.0.0'
info:
  version: 'v1'
  title: 'Test API'
servers:
  - url: 'https://api.example.com'
paths:
  /test:
    get:
      responses:
        '200':
          description: 'Success'

Example generated Refit interface

[Headers("Accept: application/json")]
public partial interface ITestApi
{
    [Get("/test")]
    Task<IApiResponse> GetTest();
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 25, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

…generation

Co-authored-by: christianhelle <710400+christianhelle@users.noreply.github.com>
@sonarqubecloud
Copy link

Copy link
Contributor Author

Copilot AI commented Dec 25, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • developers.intellihr.io
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/5ce73541d0804fe5a2448d0cbba0fc76 (dns block)
  • http://crl3.digicert.com:443/NETFoundationProjectsCodeSigningCA.crl
    • Triggering command: /usr/bin/dotnet dotnet build /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/73b63245f81c4588bdc968c4d08dda5e/Project.csproj (http block)
  • petstore.swagger.io
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/5ce73541d0804fe5a2448d0cbba0fc76 (dns block)
  • petstore3.swagger.io
    • Triggering command: /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests /home/REDACTED/work/refitter/refitter/src/Refitter.Tests/bin/Release/net8.0/Refitter.Tests --server dotnettestcli --dotnet-test-pipe /tmp/5ce73541d0804fe5a2448d0cbba0fc76 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Create .refitter settings file as part of output Add error handling, improved path logic, and tests for settings file generation Dec 25, 2025
Copilot AI requested a review from christianhelle December 25, 2025 16:18
Base automatically changed from output-refitter-file to main December 25, 2025 16:39
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