-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for generating multiple files with OpenAPI Generator #886
Add support for generating multiple files with OpenAPI Generator #886
Conversation
Removed unused `System.Diagnostics` namespace from `CSharpFileMerger.cs`. Enhanced logging in `MergeFiles` method to include details such as file count, names, and merged source code size. Updated `MergeFilesAndDeleteSource` method to suppress nullable reference warnings. Added `CopyFilesAndDeleteSource` method to copy all files/directories from input to output directory and delete the input directory. Also introduced a helper method `CopyFolder` for recursive file and directory copying.
@kipusoep Is something like this interesting for you (see PR description)? I had someone request this to me at some point but I never got around to building it. I have a cold and have been sitting on the couch coding all day so I thought I could clean up the old backlog on my open-source projects |
I'm not sure what the context is? Interesting for what exactly? :-) |
Quality Gate failedFailed conditions |
@kipusoep Generating multiple files instead of a single large code-behind file when using OpenAPI Generator. The output in this PR allows for a more understandable diff when re-generating code |
@kipusoep the screenshot in the description shows the output of generating code based on the Swagger Petstore v3 spec using OpenAPI Generator v7.5.0 from this extension |
Sounds good, but I'm still not sure what it's got to do with me specifically 😅 |
LOL, I was pretty sure that you requested the feature but it seems I remembered wrong 😑 |
PR Classification
This pull request introduces a new feature that allows the generation of multiple files in the OpenApi C# generator.
PR Summary
The pull request adds a
GenerateMultipleFiles
option to the OpenApi C# generator, which can either copy source files to a destination directory and delete the source directory, or merge the source files, sanitize the merged file, and prefix it with an autogenerated code header.OpenApiCSharpGeneratorCommand.cs
andOpenApiCSharpCodeGenerator.cs
have been updated to handle the newGenerateMultipleFiles
option.CopyFilesAndDeleteSource
has been added toCSharpFileMerger.cs
to support the new feature.GenerateMultipleFiles
property has been added toDefaultOpenApiGeneratorOptions.cs
,IOpenApiGeneratorOptions.cs
,OpenApiGeneratorOptions.cs
, andOpenApiGeneratorOptionsPage.cs
.GenerateMultipleFiles
property value is now included inOpenApiGeneratorOptions.cs
.Screenshot