Skip to content

refactor: extract CSharpClientGeneratorFactory schema mutations into IOpenApiDocumentMutator pipeline#1135

Closed
christianhelle wants to merge 5 commits into
mainfrom
improve-codebase-architecture
Closed

refactor: extract CSharpClientGeneratorFactory schema mutations into IOpenApiDocumentMutator pipeline#1135
christianhelle wants to merge 5 commits into
mainfrom
improve-codebase-architecture

Conversation

@christianhelle

@christianhelle christianhelle commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

Implements PRD #3: Decomposes four responsibilities fused into \CSharpClientGeneratorFactory\ into extracted \IOpenApiDocumentMutator\ adapters.

Changes

New files

  • IOpenApiDocumentMutator.cs — interface for document mutations
  • DisableAdditionalPropertiesMutator.cs — sets AllowAdditionalProperties=false
  • OneOfDiscriminatorToAllOfMutator.cs — converts oneOf/anyOf+discriminator to allOf
  • FixMissingIntegerTypesMutator.cs — sets schema type from format when missing
  • CustomIntegerTypeMutator.cs — applies custom integer type format
  • CustomTemplateFactory.cs — extracted from factory (with TODO for NSwag removal)
  • SafeSchemaTypeNameGenerator.cs — extracted from factory
  • JsonSchemaReferenceComparer.cs — extracted from factory
  • SchemaWalker.cs — static traversal helper for document schema trees
  • 5 test files — unit tests per mutator + factory integration tests

Refactored

  • CSharpClientGeneratorFactory — removed inline mutation logic and reflection-based \MapCSharpGeneratorSettings, replaced with mutator pipeline and explicit property copies

Testing

  • 2121 tests pass (same as baseline, 6 pre-existing NullableStringProperty failures unchanged)
  • Each mutator tested in isolation with minimal OpenApiDocument (no NSwag dependency)
  • Factory integration tests verify settings propagation

Summary by CodeRabbit

Release Notes

  • Refactor

    • Improved code generation pipeline architecture with enhanced document processing.
  • New Features

    • Added configurable integer type handling with automatic format normalization.
    • Enhanced polymorphic serialization support with improved discriminator handling.
    • Added control over additional properties generation in generated models.
    • Improved schema type inference for edge cases.
  • Tests

    • Added comprehensive test coverage for document processing and code generation workflows.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR restructures OpenAPI document preprocessing in CSharpClientGeneratorFactory by replacing inline schema mutations with a composable IOpenApiDocumentMutator pipeline. Five new mutators encapsulate schema normalization (type inference, integer format configuration, additional-properties handling, discriminator-to-inheritance conversion); supporting infrastructure enables generic schema traversal with deduplication. The factory now wires mutators into the generation flow, applies settings explicitly, and integrates a type-name normalizer.

Changes

Mutator Pipeline Architecture

Layer / File(s) Summary
Mutator Contract & Schema Traversal Foundation
src/Refitter.Core/IOpenApiDocumentMutator.cs, src/Refitter.Core/JsonSchemaReferenceComparer.cs, src/Refitter.Core/SchemaWalker.cs
IOpenApiDocumentMutator interface defines the mutation contract; JsonSchemaReferenceComparer provides identity-based deduplication for schema graph traversal; SchemaWalker statically exposes document-wide schema discovery and iterative traversal with visitor callback.
Schema Transformation Mutators
src/Refitter.Core/DisableAdditionalPropertiesMutator.cs, src/Refitter.Core/FixMissingIntegerTypesMutator.cs, src/Refitter.Core/CustomIntegerTypeMutator.cs, src/Refitter.Core/OneOfDiscriminatorToAllOfMutator.cs, src/Refitter.Core/CustomTemplateFactory.cs
Five mutators transform schemas: conditionally disable additional properties, infer type from format when missing, apply configurable integer format defaults, convert discriminator-bearing oneOf/anyOf to allOf inheritance, and override NSwag's Liquid template to inject JsonPolymorphic configuration.
Factory Refactoring & Type Name Generation
src/Refitter.Core/CSharpClientGeneratorFactory.cs, src/Refitter.Core/SafeSchemaTypeNameGenerator.cs
Constructor accepts optional IOpenApiDocumentMutator list and applies default pipeline; ApplyCodeGeneratorSettings explicitly maps settings replacing reflection-based approach; SafeSchemaTypeNameGenerator normalizes type-name hints and manages preferred exact names to avoid collisions.
Unit Tests for Mutators
src/Refitter.Tests/DisableAdditionalPropertiesMutatorTests.cs, src/Refitter.Tests/FixMissingIntegerTypesMutatorTests.cs, src/Refitter.Tests/CustomIntegerTypeMutatorTests.cs, src/Refitter.Tests/OneOfDiscriminatorToAllOfMutatorTests.cs
Four test suites verify schema transformation correctness for each mutator: conditional additional-properties disabling, type inference from format, configurable integer format rules, and discriminator-to-inheritance conversion.
Factory Integration Tests
src/Refitter.Tests/CSharpClientGeneratorFactoryIntegrationTests.cs
Five integration tests verify end-to-end factory behavior: mutator pipeline execution order, explicit mutator composition, default mutator sequence, code-generator settings property wiring, and template factory initialization with polymorphic serialization settings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • christianhelle/refitter#1085: Wires SafeSchemaTypeNameGenerator into CSharpClientGeneratorFactory and normalizes schema keys to prevent blank identifiers from malformed type names.
  • christianhelle/refitter#1064: Hardens discriminator (oneOf/anyOfallOf) conversion and additional-properties handling around null/missing schemas in the factory's document mutation logic.
  • christianhelle/refitter#772: Customizes the embedded "Class" Liquid template to inject JsonPolymorphic settings, matching the CustomTemplateFactory override approach in this PR.

Suggested labels

enhancement, .NET

Poem

🐰 A pipeline now flows through schemas with grace,
Each mutator transforms its own space—
No more inline chaos, just clean separation,
Type names and properties find normalization,
Unions to allOf inherit as planned,
The factory's art lands right where it should stand! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely describes the main refactoring effort: extracting schema mutations from CSharpClientGeneratorFactory into a separate IOpenApiDocumentMutator pipeline, which aligns with the core changes across the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve-codebase-architecture

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.

❤️ Share

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

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
src/Refitter.Core/SchemaWalker.cs (1)

37-107: ⚖️ Poor tradeoff

Consider extracting nested enumeration logic into helper methods.

SonarCloud flags this method with Cognitive Complexity 44 (threshold 15). While the logic clearly mirrors the OpenAPI document structure, you could reduce complexity by extracting sub-enumerations:

  • EnumerateComponentSchemas
  • EnumeratePathItemSchemas
  • EnumerateOperationSchemas

This is optional; the current implementation is readable and all tests pass.

🤖 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/SchemaWalker.cs` around lines 37 - 107, The
EnumerateDocumentSchemaRoots method has high cognitive complexity due to nested
loops and conditionals; refactor by extracting the nested enumeration blocks
into three helper iterator methods: EnumerateComponentSchemas(OpenApiDocument),
EnumeratePathItemSchemas(PathItem), and
EnumerateOperationSchemas(OpenApiOperation) (or similar names) and have
EnumerateDocumentSchemaRoots call them; move the logic that yields
document.Components.Schemas into EnumerateComponentSchemas, the per-path logic
(including yielding pathItem.Parameters and iterating pathItem.Values) into
EnumeratePathItemSchemas which calls EnumerateOperationSchemas for each
operation, and move the per-operation logic (yielding
operation.ActualParameters, requestBody content schemas, response headers and
response content schemas) into EnumerateOperationSchemas so the main method
simply iterates document.Paths and delegates to these helpers, preserving all
yielded types and null checks.

Source: Linters/SAST tools

src/Refitter.Core/OneOfDiscriminatorToAllOfMutator.cs (1)

8-47: ⚖️ Poor tradeoff

Consider extracting helper methods to reduce cognitive complexity.

The method handles multiple responsibilities: finding discriminated unions, validating schema types, converting union members to inheritance, and cleaning up. Extracting helpers such as ShouldTransformSchema, AddInheritanceToSubSchema, and ClearUnionCollections would improve readability and align with the 15-complexity threshold flagged by SonarCloud.

♻️ Example refactoring
 public void Mutate(OpenApiDocument document)
 {
     if (document.Components?.Schemas == null)
         return;

     foreach (var kvp in document.Components.Schemas)
     {
         var schema = kvp.Value?.ActualSchema;
         if (schema == null)
             continue;

-        if (schema.DiscriminatorObject == null)
-            continue;
-
-        var unionSchemas = schema.OneOf.Concat(schema.AnyOf).ToArray();
-        if (unionSchemas.Length == 0)
+        if (!ShouldTransformSchema(schema, out var unionSchemas))
             continue;

         if (schema.Type == JsonObjectType.None || schema.Type == JsonObjectType.Null)
             schema.Type = JsonObjectType.Object;

-        foreach (var subSchemaRef in unionSchemas)
-        {
-            var subSchema = subSchemaRef?.ActualSchema;
-            if (subSchema == null)
-                continue;
-
-            bool alreadyInherits = subSchema.AllOf.Any(
-                a => a.HasReference && a.ActualSchema == schema);
-            if (!alreadyInherits)
-            {
-                var reference = new JsonSchema { Reference = schema };
-                subSchema.AllOf.Add(reference);
-            }
-        }
+        foreach (var subSchemaRef in unionSchemas)
+            AddInheritanceToSubSchema(subSchemaRef, schema);

         schema.OneOf.Clear();
         schema.AnyOf.Clear();
     }
 }

+private static bool ShouldTransformSchema(JsonSchema schema, out JsonSchema[] unionSchemas)
+{
+    unionSchemas = [];
+    if (schema.DiscriminatorObject == null)
+        return false;
+    
+    unionSchemas = schema.OneOf.Concat(schema.AnyOf).ToArray();
+    return unionSchemas.Length > 0;
+}
+
+private static void AddInheritanceToSubSchema(JsonSchema? subSchemaRef, JsonSchema parentSchema)
+{
+    var subSchema = subSchemaRef?.ActualSchema;
+    if (subSchema == null)
+        return;
+
+    bool alreadyInherits = subSchema.AllOf.Any(
+        a => a.HasReference && a.ActualSchema == parentSchema);
+    if (!alreadyInherits)
+    {
+        var reference = new JsonSchema { Reference = parentSchema };
+        subSchema.AllOf.Add(reference);
+    }
+}
🤖 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/OneOfDiscriminatorToAllOfMutator.cs` around lines 8 - 47,
The Mutate method in OneOfDiscriminatorToAllOfMutator is too complex; extract
small helpers to make intent explicit and reduce cognitive complexity: create
ShouldTransformSchema(JsonSchema schema) to encapsulate the early checks (schema
!= null, schema.DiscriminatorObject != null, unionSchemas.Length>0 and ensure
schema.Type is set to JsonObjectType.Object when needed), create
AddInheritanceToSubSchema(JsonSchema parent, JsonSchema subSchema) to check
subSchema.AllOf for existing reference to parent and add new JsonSchema {
Reference = parent } when missing, and create ClearUnionCollections(JsonSchema
schema) to Clear() schema.OneOf and schema.AnyOf; update Mutate to call these
helpers and to use unionSchemas = schema.OneOf.Concat(schema.AnyOf).ToArray()
and loop calling AddInheritanceToSubSchema for each subSchemaRef?.ActualSchema;
keep all semantics (use ActualSchema, HasReference, AllOf) unchanged.

Source: Linters/SAST tools

src/Refitter.Tests/CSharpClientGeneratorFactoryIntegrationTests.cs (3)

49-56: ⚡ Quick win

Manually constructing the mutator array duplicates factory logic.

The mutator construction here mirrors CSharpClientGeneratorFactory.CreateDefaultMutators. If the factory's default mutator order or configuration changes, this test won't detect the drift.

♻️ Consider letting the factory create default mutators

Remove the explicit mutators parameter to test the factory's actual default pipeline:

-        var mutators = new IOpenApiDocumentMutator[]
-        {
-            new DisableAdditionalPropertiesMutator(settings.GenerateDefaultAdditionalProperties),
-            new OneOfDiscriminatorToAllOfMutator(),
-            new FixMissingIntegerTypesMutator(),
-            new CustomIntegerTypeMutator(
-                settings.CodeGeneratorSettings?.IntegerType ?? IntegerType.Int32),
-        };
-
-        var factory = new CSharpClientGeneratorFactory(settings, document, mutators);
+        var factory = new CSharpClientGeneratorFactory(settings, document);
🤖 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.Tests/CSharpClientGeneratorFactoryIntegrationTests.cs` around
lines 49 - 56, The test is duplicating factory logic by constructing the
mutators array instead of using the factory's defaults; update the test in
CSharpClientGeneratorFactoryIntegrationTests to stop manually creating that
IOpenApiDocumentMutator[] and instead use the factory's default pipeline (either
remove the explicit mutators parameter so the factory constructs defaults, or
call CSharpClientGeneratorFactory.CreateDefaultMutators(settings) and pass that
result) so the test exercises the actual default mutator order/configuration
defined by CSharpClientGeneratorFactory.

13-65: ⚡ Quick win

Test name suggests order verification but only checks namespace.

The method name Create_AppliesMutatorsInOrder_BeforeBuildingGenerator implies that mutator application order is verified, yet the test only asserts the namespace was set. Consider adding assertions that confirm the mutations actually executed (e.g., verify Vehicle.OneOf is empty, Car.id type is set, Car.count format is "int64").

🤖 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.Tests/CSharpClientGeneratorFactoryIntegrationTests.cs` around
lines 13 - 65, The test Create_AppliesMutatorsInOrder_BeforeBuildingGenerator
currently only checks the generator namespace but should also assert that the
mutators actually ran: after constructing the factory and calling Create(), add
FluentAssertions checks against the mutated OpenAPI document (the local document
variable) to verify mutator effects—e.g., that
document.Components.Schemas["Vehicle"].OneOf is null or empty (OneOf
moved/removed), that document.Components.Schemas["Car"].Properties["id"] has the
expected integer type/format set by
FixMissingIntegerTypesMutator/CustomIntegerTypeMutator (format "int64" or
IntegerType mapping), and that
document.Components.Schemas["Car"].Properties["count"].Type/Format reflects
"integer" with format "int64"; use the existing mutator names
(DisableAdditionalPropertiesMutator, OneOfDiscriminatorToAllOfMutator,
FixMissingIntegerTypesMutator, CustomIntegerTypeMutator) as guidance when
locating where to assert these changes and use FluentAssertions in the same
style as the existing assertions.

15-38: 💤 Low value

Consider extracting inline OpenAPI JSON strings.

The large inline JSON strings are repeated across tests with minor variations. Extracting them into helper methods or constants could improve maintainability and reduce duplication.

♻️ Example refactoring approach
private static string CreateMinimalOpenApiDocument() => """
    {
      "openapi": "3.0.1",
      "info": { "title": "Test", "version": "1.0" },
      "paths": {}
    }
    """;

private static string CreateOpenApiDocumentWithSchema(string schemasJson) => $$"""
    {
      "openapi": "3.0.1",
      "info": { "title": "Test", "version": "1.0" },
      "paths": {},
      "components": {
        "schemas": {{schemasJson}}
      }
    }
    """;

Also applies to: 70-87, 116-136, 157-163, 190-196

🤖 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.Tests/CSharpClientGeneratorFactoryIntegrationTests.cs` around
lines 15 - 38, Extract the repeated inline OpenAPI JSON literals into private
static helper methods in the CSharpClientGeneratorFactoryIntegrationTests test
class (e.g., CreateMinimalOpenApiDocument() returning the base document string
and CreateOpenApiDocumentWithSchema(string schemasJson) that injects schemas),
then replace each large inline JSON block (the document variable creation and
the other similar blocks noted in the review) with calls to these helpers,
passing only the varying schema fragment (e.g., the "Vehicle"/"Car" schema JSON)
so tests reuse the shared base document and reduce duplication.
🤖 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.Tests/CSharpClientGeneratorFactoryIntegrationTests.cs`:
- Line 155: Rename the test method
Create_WithCodeGeneratorSettings_AppliesExplictPropertyCopies to
Create_WithCodeGeneratorSettings_AppliesExplicitPropertyCopies to fix the typo;
update the method declaration and any references (test attributes, usages, or
string-based names in test runners) that refer to
Create_WithCodeGeneratorSettings_AppliesExplictPropertyCopies so they point to
Create_WithCodeGeneratorSettings_AppliesExplicitPropertyCopies.

---

Nitpick comments:
In `@src/Refitter.Core/OneOfDiscriminatorToAllOfMutator.cs`:
- Around line 8-47: The Mutate method in OneOfDiscriminatorToAllOfMutator is too
complex; extract small helpers to make intent explicit and reduce cognitive
complexity: create ShouldTransformSchema(JsonSchema schema) to encapsulate the
early checks (schema != null, schema.DiscriminatorObject != null,
unionSchemas.Length>0 and ensure schema.Type is set to JsonObjectType.Object
when needed), create AddInheritanceToSubSchema(JsonSchema parent, JsonSchema
subSchema) to check subSchema.AllOf for existing reference to parent and add new
JsonSchema { Reference = parent } when missing, and create
ClearUnionCollections(JsonSchema schema) to Clear() schema.OneOf and
schema.AnyOf; update Mutate to call these helpers and to use unionSchemas =
schema.OneOf.Concat(schema.AnyOf).ToArray() and loop calling
AddInheritanceToSubSchema for each subSchemaRef?.ActualSchema; keep all
semantics (use ActualSchema, HasReference, AllOf) unchanged.

In `@src/Refitter.Core/SchemaWalker.cs`:
- Around line 37-107: The EnumerateDocumentSchemaRoots method has high cognitive
complexity due to nested loops and conditionals; refactor by extracting the
nested enumeration blocks into three helper iterator methods:
EnumerateComponentSchemas(OpenApiDocument), EnumeratePathItemSchemas(PathItem),
and EnumerateOperationSchemas(OpenApiOperation) (or similar names) and have
EnumerateDocumentSchemaRoots call them; move the logic that yields
document.Components.Schemas into EnumerateComponentSchemas, the per-path logic
(including yielding pathItem.Parameters and iterating pathItem.Values) into
EnumeratePathItemSchemas which calls EnumerateOperationSchemas for each
operation, and move the per-operation logic (yielding
operation.ActualParameters, requestBody content schemas, response headers and
response content schemas) into EnumerateOperationSchemas so the main method
simply iterates document.Paths and delegates to these helpers, preserving all
yielded types and null checks.

In `@src/Refitter.Tests/CSharpClientGeneratorFactoryIntegrationTests.cs`:
- Around line 49-56: The test is duplicating factory logic by constructing the
mutators array instead of using the factory's defaults; update the test in
CSharpClientGeneratorFactoryIntegrationTests to stop manually creating that
IOpenApiDocumentMutator[] and instead use the factory's default pipeline (either
remove the explicit mutators parameter so the factory constructs defaults, or
call CSharpClientGeneratorFactory.CreateDefaultMutators(settings) and pass that
result) so the test exercises the actual default mutator order/configuration
defined by CSharpClientGeneratorFactory.
- Around line 13-65: The test
Create_AppliesMutatorsInOrder_BeforeBuildingGenerator currently only checks the
generator namespace but should also assert that the mutators actually ran: after
constructing the factory and calling Create(), add FluentAssertions checks
against the mutated OpenAPI document (the local document variable) to verify
mutator effects—e.g., that document.Components.Schemas["Vehicle"].OneOf is null
or empty (OneOf moved/removed), that
document.Components.Schemas["Car"].Properties["id"] has the expected integer
type/format set by FixMissingIntegerTypesMutator/CustomIntegerTypeMutator
(format "int64" or IntegerType mapping), and that
document.Components.Schemas["Car"].Properties["count"].Type/Format reflects
"integer" with format "int64"; use the existing mutator names
(DisableAdditionalPropertiesMutator, OneOfDiscriminatorToAllOfMutator,
FixMissingIntegerTypesMutator, CustomIntegerTypeMutator) as guidance when
locating where to assert these changes and use FluentAssertions in the same
style as the existing assertions.
- Around line 15-38: Extract the repeated inline OpenAPI JSON literals into
private static helper methods in the
CSharpClientGeneratorFactoryIntegrationTests test class (e.g.,
CreateMinimalOpenApiDocument() returning the base document string and
CreateOpenApiDocumentWithSchema(string schemasJson) that injects schemas), then
replace each large inline JSON block (the document variable creation and the
other similar blocks noted in the review) with calls to these helpers, passing
only the varying schema fragment (e.g., the "Vehicle"/"Car" schema JSON) so
tests reuse the shared base document and reduce duplication.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c60947d6-cd49-4e00-b3f2-4c969e0aba36

📥 Commits

Reviewing files that changed from the base of the PR and between 7d03c6a and 046d3ad.

📒 Files selected for processing (15)
  • src/Refitter.Core/CSharpClientGeneratorFactory.cs
  • src/Refitter.Core/CustomIntegerTypeMutator.cs
  • src/Refitter.Core/CustomTemplateFactory.cs
  • src/Refitter.Core/DisableAdditionalPropertiesMutator.cs
  • src/Refitter.Core/FixMissingIntegerTypesMutator.cs
  • src/Refitter.Core/IOpenApiDocumentMutator.cs
  • src/Refitter.Core/JsonSchemaReferenceComparer.cs
  • src/Refitter.Core/OneOfDiscriminatorToAllOfMutator.cs
  • src/Refitter.Core/SafeSchemaTypeNameGenerator.cs
  • src/Refitter.Core/SchemaWalker.cs
  • src/Refitter.Tests/CSharpClientGeneratorFactoryIntegrationTests.cs
  • src/Refitter.Tests/CustomIntegerTypeMutatorTests.cs
  • src/Refitter.Tests/DisableAdditionalPropertiesMutatorTests.cs
  • src/Refitter.Tests/FixMissingIntegerTypesMutatorTests.cs
  • src/Refitter.Tests/OneOfDiscriminatorToAllOfMutatorTests.cs

}

[Test]
public async Task Create_WithCodeGeneratorSettings_AppliesExplictPropertyCopies()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Typo in method name: "Explict" should be "Explicit".

The method name contains a spelling error that should be corrected for consistency and readability.

📝 Proposed fix
-    public async Task Create_WithCodeGeneratorSettings_AppliesExplictPropertyCopies()
+    public async Task Create_WithCodeGeneratorSettings_AppliesExplicitPropertyCopies()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public async Task Create_WithCodeGeneratorSettings_AppliesExplictPropertyCopies()
public async Task Create_WithCodeGeneratorSettings_AppliesExplicitPropertyCopies()
🤖 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.Tests/CSharpClientGeneratorFactoryIntegrationTests.cs` at line
155, Rename the test method
Create_WithCodeGeneratorSettings_AppliesExplictPropertyCopies to
Create_WithCodeGeneratorSettings_AppliesExplicitPropertyCopies to fix the typo;
update the method declaration and any references (test attributes, usages, or
string-based names in test runners) that refer to
Create_WithCodeGeneratorSettings_AppliesExplictPropertyCopies so they point to
Create_WithCodeGeneratorSettings_AppliesExplicitPropertyCopies.

@christianhelle
christianhelle deleted the improve-codebase-architecture branch June 13, 2026 21:20
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.

1 participant