Skip to content

Contract post processing adapters in GeneratorPipeline#1138

Closed
christianhelle wants to merge 5 commits into
improve-codebase-architecturefrom
feat/generator-pipeline
Closed

Contract post processing adapters in GeneratorPipeline#1138
christianhelle wants to merge 5 commits into
improve-codebase-architecturefrom
feat/generator-pipeline

Conversation

@christianhelle

Copy link
Copy Markdown
Owner

Summary

Implements PRD #2: GeneratorPipeline — Replacing Inline Dependencies with Injected Seams.

Changes

  • New: \IContractsPostProcessor\ interface for composable post-generation contract transforms
  • New: \Swagger2OptionalReferenceNullabilityNormalizer\ — normalizes Swagger 2.0 optional reference type nullability (extracted from \GeneratorPipeline.NormalizeSwagger2OptionalReferencePropertyNullability)
  • New: \EnumStringConverterInjector\ — injects \JsonStringEnumConverter\ attributes on enum declarations (extracted from \GeneratorPipeline.SanitizeGeneratedContracts)
  • Refactor: \GeneratorPipeline\ now accepts \XmlDocumentationGenerator, \InterfaceGenerator, and \IEnumerable\ via constructor injection instead of creating them inline with
    ew\
  • Refactor: Three \internal static\ helpers (\SanitizeGeneratedContracts, \NormalizeSwagger2OptionalReferencePropertyNullability, \GenerateJsonSerializerContext) removed from \GeneratorPipeline's public surface — the first two live as post-processors, the third stays as a private method in \Run()\
  • Refactor: \RefitGenerator.RunPipeline()\ constructs the pipeline with real dependencies; private wrapper methods removed
  • Test: All affected tests updated to use the new API directly instead of reflection

Verification

  • ✅ Build succeeds with zero errors
  • ✅ All 2152 tests pass across all three test projects

Add IContractsPostProcessor interface for post-generation contract
transformation. Create Swagger2OptionalReferenceNullabilityNormalizer
and EnumStringConverterInjector implementations, extracted from
GeneratorPipeline.SanitizeGeneratedContracts and
NormalizeSwagger2OptionalReferencePropertyNullability.
GeneratorPipeline now accepts XmlDocumentationGenerator, InterfaceGenerator,
and IContractsPostProcessor collection via constructor instead of creating
them inline. The three internal static helpers (SanitizeGeneratedContracts,
NormalizeSwagger2OptionalReferencePropertyNullability, GenerateJsonSerializerContext)
are removed from public API surface. SanitizeGeneratedContracts and
NormalizeSwagger2OptionalReferencePropertyNullability now live in the
IContractsPostProcessor implementations. GenerateJsonSerializerContext
remains as a private helper called inline in Run().
Removed private wrapper methods (SanitizeGeneratedContracts,
NormalizeSwagger2OptionalReferencePropertyNullability,
GenerateJsonSerializerContext) that leaked pipeline internals.
RunPipeline() now constructs GeneratorPipeline with real
XmlDocumentationGenerator, InterfaceGenerator, and post-processors.
Update GeneratorPipelineTests to construct GeneratorPipeline with
constructor args. Update RefitGeneratorAdvancedTests to test
Swagger2OptionalReferenceNullabilityNormalizer and
JsonSerializerContextGenerator directly instead of using
reflection on removed private methods.
Test was using reflection on removed RefitGenerator.SanitizeGeneratedContracts
method. Now tests EnumStringConverterInjector directly.
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7504f7a1-213e-4463-819c-a73e70f2e385

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/generator-pipeline

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.

@christianhelle christianhelle changed the title feat: GeneratorPipeline — injected seams and IContractsPostProcessor adapters Contract post processing adapters in GeneratorPipeline Jun 14, 2026
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (improve-codebase-architecture@7d03c6a). Learn more about missing BASE report.

Additional details and impacted files
@@                       Coverage Diff                        @@
##             improve-codebase-architecture    #1138   +/-   ##
================================================================
  Coverage                                 ?   94.75%           
================================================================
  Files                                    ?       41           
  Lines                                    ?     2669           
  Branches                                 ?        0           
================================================================
  Hits                                     ?     2529           
  Misses                                   ?       46           
  Partials                                 ?       94           
Flag Coverage Δ
unittests 94.75% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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