Refactor OpenApiWeaver source generator to use IndentedStringBuilder for improved code formatting#45
Merged
Merged
Conversation
shibayan
commented
Apr 15, 2026
Owner
- Updated methods in ClientEmitter.RequestBodies.cs to replace StringBuilder with IndentedStringBuilder for better indentation handling.
- Refactored EmitRequestBodyContentAssignment, EmitFormUrlEncodedContentAssignment, and EmitMultipartFormDataContentAssignment methods.
- Enhanced EmitSchema and EmitEnumSchema methods in ClientEmitter.Schemas.cs to utilize IndentedStringBuilder.
- Modified EmitSupportTypes, EmitExceptionTypes, and EmitHelperClass methods in ClientEmitter.cs for consistent formatting.
- Updated project dependencies in OpenApiWeaver.Tests.csproj to use Microsoft.OpenApi version 3.5.2.
…for improved code formatting - Updated methods in ClientEmitter.RequestBodies.cs to replace StringBuilder with IndentedStringBuilder for better indentation handling. - Refactored EmitRequestBodyContentAssignment, EmitFormUrlEncodedContentAssignment, and EmitMultipartFormDataContentAssignment methods. - Enhanced EmitSchema and EmitEnumSchema methods in ClientEmitter.Schemas.cs to utilize IndentedStringBuilder. - Modified EmitSupportTypes, EmitExceptionTypes, and EmitHelperClass methods in ClientEmitter.cs for consistent formatting. - Updated project dependencies in OpenApiWeaver.Tests.csproj to use Microsoft.OpenApi version 3.5.2.
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the OpenApiWeaver client source generator to centralize indentation/formatting via a new IndentedStringBuilder, and bumps Microsoft.OpenApi dependencies.
Changes:
- Introduces
IndentedStringBuilderand refactors emitter codepaths (schemas, operations, request bodies, helpers) to use it for consistent indentation. - Updates Microsoft.OpenApi / Microsoft.OpenApi.YamlReader package references to
3.5.2. - Updates documentation prerequisites to .NET SDK 10.0+.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/OpenApiWeaver.Tests/OpenApiWeaver.Tests.csproj | Bumps Microsoft.OpenApi dependencies for tests. |
| src/OpenApiWeaver/OpenApiWeaverSourceGenerator.ClientEmitter.cs | Refactors core client/support type emission to use IndentedStringBuilder. |
| src/OpenApiWeaver/OpenApiWeaverSourceGenerator.ClientEmitter.Schemas.cs | Refactors schema/enum emission to use IndentedStringBuilder. |
| src/OpenApiWeaver/OpenApiWeaverSourceGenerator.ClientEmitter.RequestBodies.cs | Refactors request-body emission to use IndentedStringBuilder and helper emitters. |
| src/OpenApiWeaver/OpenApiWeaverSourceGenerator.ClientEmitter.Operations.cs | Refactors operation emission to use IndentedStringBuilder. |
| src/OpenApiWeaver/OpenApiWeaverSourceGenerator.ClientEmitter.Naming.cs | Adds EmitDocComment overload for IndentedStringBuilder; updates security scheme init emission. |
| src/OpenApiWeaver/OpenApiWeaverSourceGenerator.ClientEmitter.IndentedStringBuilder.cs | Adds the new indentation-aware writer utility. |
| src/OpenApiWeaver/OpenApiWeaver.csproj | Bumps Microsoft.OpenApi dependencies for the generator package. |
| docs/ja/getting-started.md | Updates prerequisites version. |
| docs/en/getting-started.md | Updates prerequisites version. |
| README.md | Updates prerequisites version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.