Add support for generating multiple files per Refit interface #502
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.
This pull request includes several significant changes to the
Refitter.Core
project, primarily focusing on adding support for generating multiple Refit interface files, renaming constants, and improving code generation. The changes also include updates to project dependencies and minor formatting adjustments.Example 1 - Generate multiple files with multiple interfaces by endpoint
The following settings file:
Outputs the following:
Example 2 - Generate multiple files for multiple interfaces by tag
The following settings file:
Outputs the following
Renaming and Refactoring:
FilenameConstants
toTypenameConstants
and updated the constants to exclude the.cs
extension insrc/Refitter.Core/FilenameConstants.cs
.GeneratedCode
record to include a computedFilename
property based onTypeName
insrc/Refitter.Core/GeneratedCode.cs
.Code Generation Enhancements:
GenerateCode
method inIRefitInterfaceGenerator
and its implementations to returnIEnumerable<GeneratedCode>
instead of a singleRefitGeneratedCode
in multiple files, includingsrc/Refitter.Core/IRefitInterfaceGenerator.cs
,src/Refitter.Core/RefitInterfaceGenerator.cs
,src/Refitter.Core/RefitMultipleInterfaceByTagGenerator.cs
, andsrc/Refitter.Core/RefitMultipleInterfaceGenerator.cs
. [1] [2] [3] [4]GenerateClient
method to handle multipleGeneratedCode
objects and updated theGenerate
andGenerateMultipleFiles
methods accordingly insrc/Refitter.Core/RefitGenerator.cs
. [1] [2] [3] [4] [5]Dependency Updates:
System.Text.Json
package reference tosrc/Refitter.Core/Refitter.Core.csproj
andsrc/Refitter.Tests/Build/ProjectFileContents.cs
. [1] [2]Minor Changes:
src/Refitter/GenerateCommand.cs
.ContractsOutputFolder
inWriteMultipleFiles
method to use the updatedTypenameConstants.Contracts
insrc/Refitter/GenerateCommand.cs
.Related issues: