Refactor support type and operation emitters#92
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the code-generation emitters by splitting large emitter classes into focused partial files and centralizing support-type naming/reservations, aiming to keep generated output behavior unchanged while improving maintainability.
Changes:
- Introduced
SupportTypeNamesto centralize support-type names, reservations, and default serializer-options expression. - Split
OperationEmitterhelper logic into partial files (error responses, parameters, security, serialization). - Split
SupportTypesEmitterinto partial files grouped by helper/category (exceptions, helpers, parameter formatting, query, cookie, response).
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/OpenApiWeaver/SupportTypeNames.cs | Centralizes support type names, reserved names, and serializer-options naming helpers. |
| src/OpenApiWeaver/OperationEmitter.cs | Converts to partial and keeps core operation emission, delegating helper logic to partials. |
| src/OpenApiWeaver/OperationEmitter.ErrorResponses.cs | Moves error-response handling emission into a focused partial file. |
| src/OpenApiWeaver/OperationEmitter.Parameters.cs | Moves route/query/header/cookie parameter emission helpers into a focused partial file. |
| src/OpenApiWeaver/OperationEmitter.Security.cs | Moves security requirement/scheme selection helpers into a focused partial file. |
| src/OpenApiWeaver/OperationEmitter.Serialization.cs | Moves serializer-options expression helper into a focused partial file. |
| src/OpenApiWeaver/JsonSerializerOptionsEmitter.cs | Uses centralized default serializer-options expression constant. |
| src/OpenApiWeaver/ClientGenerator.Transformer.cs | Uses centralized serializer-options type naming helper when allocating the options type name. |
| src/OpenApiWeaver/ClientGenerator.Transformer.Schemas.cs | Uses centralized support-type reservation helper for schema-name reservation. |
| src/OpenApiWeaver/ClientGenerator.Transformer.Tags.cs | Uses centralized reserved support-type names when reserving client class names. |
| src/OpenApiWeaver/ClientGenerator.SupportTypesEmitter.cs | Converts to partial and keeps the top-level support-types emission entry point. |
| src/OpenApiWeaver/ClientGenerator.SupportTypesEmitter.Exceptions.cs | Extracts exception type emission into its own partial emitter. |
| src/OpenApiWeaver/ClientGenerator.SupportTypesEmitter.Helpers.cs | Extracts helper-class emission and composes helper sections via partial emitters. |
| src/OpenApiWeaver/ClientGenerator.SupportTypesEmitter.ParameterFormatting.cs | Extracts parameter-formatting helpers into its own partial emitter. |
| src/OpenApiWeaver/ClientGenerator.SupportTypesEmitter.Query.cs | Extracts query-string helpers into its own partial emitter. |
| src/OpenApiWeaver/ClientGenerator.SupportTypesEmitter.Cookie.cs | Extracts cookie header helpers into its own partial emitter. |
| src/OpenApiWeaver/ClientGenerator.SupportTypesEmitter.Response.cs | Extracts response/content-type/status-code/deserialize helpers into its own partial emitter. |
💡 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.
Summary
SupportTypesEmitterinto focused partial emitters for exceptions, helpers, parameter formatting, query, cookie, and response helpers.SupportTypeNamesto centralize support type reservations and default serializer options references.OperationEmitterhelper logic into focused partial files for error responses, parameters, security, and serialization.Impact
This is intended to be behavior-preserving. It reduces oversized emitter files and makes the remaining generation responsibilities easier to review and extend.
Validation
dotnet test OpenApiWeaver.slnx --no-restoregit diff --check