Split RefitGeneratorSettings into focused config records#1148
Conversation
Create 8 domain-focused configuration records that partition the 50+ properties of RefitGeneratorSettings into small, stable interfaces: - OpenApiSourceConfig: OpenAPI source paths - CodeGenerationConfig: what to generate (contracts, clients, etc.) - ParameterConfig: cancellation tokens, date format, collection format - OutputConfig: output paths, namespace, filename - TypeConfig: type accessibility, naming policy, contract suffix - FilterConfig: tags, path matches, namespace filtering - SchemaConfig: schema trimming settings - FeatureConfig: Apizr, polymorphism, auth headers, security scheme Each config class has its own defaults and owns one domain. JSON attributes are duplicated on RefitGeneratorSettings properties for backward-compatible serialization.
RefitGeneratorSettings now composes 8 focused config records instead of holding 50+ properties directly. Each property delegates to its owning record: - OpenApi properties -> OpenApiSourceConfig - Code generation toggles -> CodeGenerationConfig - Parameter options -> ParameterConfig - Output paths/namespace -> OutputConfig - Type accessibility/naming -> TypeConfig - Filtering -> FilterConfig - Schema trimming -> SchemaConfig - Feature flags -> FeatureConfig Preserved as direct properties (existing separate classes): NamingSettings, CodeGeneratorSettings, DependencyInjectionSettings. JSON serialization contract is unchanged — all [JsonPropertyName] attributes remain on RefitGeneratorSettings properties. The public API surface is identical; all consumers compile without changes.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughEight new focused configuration POCOs are introduced: ChangesSettings Decomposition and RefitGeneratorSettings Delegation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/Refitter.Core/Settings/RefitGeneratorSettings.cs (1)
11-447: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy liftAdd XML documentation comments for the public API surface.
This refactor keeps a large public API, but the public class/members still lack XML doc comments (
/// <summary>...). Please add XML docs for the class and public members so API consumers get proper IntelliSense/docs output.Example pattern
+/// <summary> +/// Defines settings for Refit code generation. +/// </summary> public class RefitGeneratorSettings { + /// <summary> + /// Default output folder for generated files. + /// </summary> public const string DefaultOutputFolder = OutputConfig.DefaultOutputFolder;As per coding guidelines,
**/*.cs: Include XML documentation for public APIs in C# code.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/Refitter.Core/Settings/RefitGeneratorSettings.cs` around lines 11 - 447, The RefitGeneratorSettings class and its public properties lack XML documentation comments. Add XML doc comments (`/// <summary>...</summary>`) above the RefitGeneratorSettings class declaration itself and above each public property definition to provide proper IntelliSense documentation for API consumers. Ensure each comment clearly describes the purpose and behavior of the class and respective properties, matching the descriptions already provided in the [Description] attributes where applicable.Source: Coding guidelines
🧹 Nitpick comments (1)
src/Refitter.Core/Settings/OpenApiSourceConfig.cs (1)
8-17: ⚡ Quick winAdd XML documentation to the public API surface in this config class.
OpenApiSourceConfigand its public properties are exposed APIs, but they currently rely only on[Description]. Please add/// <summary>XML docs for the class and each public property to meet repository standards.As per coding guidelines, "Include XML documentation for public APIs in C# code."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/Refitter.Core/Settings/OpenApiSourceConfig.cs` around lines 8 - 17, The OpenApiSourceConfig class and its public properties OpenApiPath and OpenApiPaths are missing XML documentation comments required for public API surface. Add /// <summary> XML documentation blocks above the class definition and above each property to document their purpose, complementing the existing [Description] attributes. Ensure the XML docs clearly describe what each property represents and its usage.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/Refitter.Core/Settings/CodeGenerationConfig.cs`:
- Around line 45-50: The Description attribute for the ResponseTypeOverride
property contains text that references AddAcceptHeaders, which is incorrect
copy-paste content. Update the Description text in the ResponseTypeOverride
property definition to accurately describe what this property does (mapping
operation ids to specific response types that should be used, with the type
wrapped in a task). Ensure the corrected description clearly explains the
property's purpose rather than describing a different feature.
In `@src/Refitter.Core/Settings/OutputConfig.cs`:
- Around line 24-30: Fix the Description text for the OutputFilename property in
the OutputConfig class by correcting the typo "The the Source Generator" to "The
Source Generator" and fixing the malformed sentence structure. The description
should have proper punctuation and syntax — remove the stray closing parenthesis
and ensure the sentence about the default value for the Source Generator is
complete and grammatically correct.
---
Outside diff comments:
In `@src/Refitter.Core/Settings/RefitGeneratorSettings.cs`:
- Around line 11-447: The RefitGeneratorSettings class and its public properties
lack XML documentation comments. Add XML doc comments (`///
<summary>...</summary>`) above the RefitGeneratorSettings class declaration
itself and above each public property definition to provide proper IntelliSense
documentation for API consumers. Ensure each comment clearly describes the
purpose and behavior of the class and respective properties, matching the
descriptions already provided in the [Description] attributes where applicable.
---
Nitpick comments:
In `@src/Refitter.Core/Settings/OpenApiSourceConfig.cs`:
- Around line 8-17: The OpenApiSourceConfig class and its public properties
OpenApiPath and OpenApiPaths are missing XML documentation comments required for
public API surface. Add /// <summary> XML documentation blocks above the class
definition and above each property to document their purpose, complementing the
existing [Description] attributes. Ensure the XML docs clearly describe what
each property represents and its usage.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 80ae83c9-88d8-415d-ae6d-611dbb6c1d01
📒 Files selected for processing (9)
src/Refitter.Core/Settings/CodeGenerationConfig.cssrc/Refitter.Core/Settings/FeatureConfig.cssrc/Refitter.Core/Settings/FilterConfig.cssrc/Refitter.Core/Settings/OpenApiSourceConfig.cssrc/Refitter.Core/Settings/OutputConfig.cssrc/Refitter.Core/Settings/ParameterConfig.cssrc/Refitter.Core/Settings/RefitGeneratorSettings.cssrc/Refitter.Core/Settings/SchemaConfig.cssrc/Refitter.Core/Settings/TypeConfig.cs
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1148 +/- ##
=======================================
Coverage 94.54% 94.54%
=======================================
Files 67 67
Lines 3100 3100
=======================================
Hits 2931 2931
Misses 59 59
Partials 110 110
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Restore XML doc comments on RefitGeneratorSettings properties that were removed during the composition refactoring. Add XML doc comments to all new config record classes and their public properties/members.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/Refitter.Core/Settings/RefitGeneratorSettings.cs (1)
204-209:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix stale public API description text.
Several docs/
Descriptionvalues are copy-paste stale or misleading:ResponseTypeOverridesays “AddAcceptHeaders dictionary”,IncludeTagsdescribes multiple interfaces,OutputFilenamesays “The the Source Generator”,GenerateDefaultAdditionalPropertiesdescribes skipping while the property controls generation, andApizrSettingshas “Get ot set”. These can leak into API docs, schema, or CLI help. As per coding guidelines, include XML documentation for public APIs in C# code.Suggested wording cleanup
- AddAcceptHeaders dictionary of operation ids and a specific response type that they should use. + Dictionary of operation ids and the specific response type that they should use. - [Description("Generate a Refit interface for each endpoint.")] + [Description("Only include endpoints that contain this tag. May be set multiple times and result in OR'ed evaluation.")] - The the Source Generator, this is the name of the generated class + For the Source Generator, this is the name of the generated class - [Description("Skip default additional properties. Default is true.")] + [Description("Generate default additional properties. Default is true.")] - /// Get ot set the settings describing how to configure Apizr + /// Gets or sets the settings describing how to configure Apizr.Also applies to: 315-320, 387-394, 474-478, 494-496
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/Refitter.Core/Settings/RefitGeneratorSettings.cs` around lines 204 - 209, Fix stale and inaccurate Description attributes for several public API properties in RefitGeneratorSettings.cs across multiple locations. The ResponseTypeOverride property (lines 204-209) incorrectly references "AddAcceptHeaders dictionary" instead of describing its actual purpose; IncludeTags (lines 315-320) has misleading text about multiple interfaces; OutputFilename (lines 387-394) contains "The the" and inaccurate description; GenerateDefaultAdditionalProperties (lines 474-478) describes skipping instead of generation; and ApizrSettings (lines 494-496) contains the typo "Get ot set". Update each Description attribute to accurately reflect what each property actually does, correcting copy-paste errors, typos, and misleading content. Additionally, consider adding proper XML documentation comments (///) for these public APIs as per C# coding guidelines.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/Refitter.Core/Settings/RefitGeneratorSettings.cs`:
- Around line 204-209: Fix stale and inaccurate Description attributes for
several public API properties in RefitGeneratorSettings.cs across multiple
locations. The ResponseTypeOverride property (lines 204-209) incorrectly
references "AddAcceptHeaders dictionary" instead of describing its actual
purpose; IncludeTags (lines 315-320) has misleading text about multiple
interfaces; OutputFilename (lines 387-394) contains "The the" and inaccurate
description; GenerateDefaultAdditionalProperties (lines 474-478) describes
skipping instead of generation; and ApizrSettings (lines 494-496) contains the
typo "Get ot set". Update each Description attribute to accurately reflect what
each property actually does, correcting copy-paste errors, typos, and misleading
content. Additionally, consider adding proper XML documentation comments (///)
for these public APIs as per C# coding guidelines.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fdcc321c-5482-47f9-8e18-76ee5762bc73
📒 Files selected for processing (9)
src/Refitter.Core/Settings/CodeGenerationConfig.cssrc/Refitter.Core/Settings/FeatureConfig.cssrc/Refitter.Core/Settings/FilterConfig.cssrc/Refitter.Core/Settings/OpenApiSourceConfig.cssrc/Refitter.Core/Settings/OutputConfig.cssrc/Refitter.Core/Settings/ParameterConfig.cssrc/Refitter.Core/Settings/RefitGeneratorSettings.cssrc/Refitter.Core/Settings/SchemaConfig.cssrc/Refitter.Core/Settings/TypeConfig.cs
✅ Files skipped from review due to trivial changes (1)
- src/Refitter.Core/Settings/CodeGenerationConfig.cs
🚧 Files skipped from review as they are similar to previous changes (7)
- src/Refitter.Core/Settings/FilterConfig.cs
- src/Refitter.Core/Settings/TypeConfig.cs
- src/Refitter.Core/Settings/OutputConfig.cs
- src/Refitter.Core/Settings/SchemaConfig.cs
- src/Refitter.Core/Settings/OpenApiSourceConfig.cs
- src/Refitter.Core/Settings/FeatureConfig.cs
- src/Refitter.Core/Settings/ParameterConfig.cs
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 2 file(s) based on 2 unresolved review comments. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 2 file(s) based on 2 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
|



Summary
Deepens \RefitGeneratorSettings\ by splitting its 50+ properties into 8 focused configuration records that compose. The public API surface is identical — properties delegate to their owning record internally.
Changes
New files (8 config records)
Modified files
Preserved as direct properties (existing separate classes)
Design Decisions
Verification
Summary by CodeRabbit