OpenAPITools / OpenAPITools/openapi-generator
[REQ][csharp-netcore] httpclient library please remove old constructors
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
I would like to have a setting to not create old constructors when generating client for csharp-netcore httpclient library.
Currently I have large existing code base and we are migrating to .net core and same time converting our generated API clients to use http client based code. Because RestSharp in .net core may cause port exhaustion issue. Now when migrating the existing codebase it is difficult to find all the areas which need to be changed because the new generated code compiles the same as previous restsharp client did, however it would fail runtime to socket exhaustion issue.
Describe the solution you'd like
I would like to have an option or change http client library generator so that it does not generate constructors where its not required to give http client as parameter.
Describe alternatives you've considered
I have considered manually changing the generated code by commenting out these constructors but its problematic when we re-generate the code.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with modules/openapi-generator/src/main/resources/csharp-netcore/libraries/httpclient/ApiClient.mustache, especially lines 192–217, to understand which constructors are generated for the csharp-netcore httpclient library. Add an option or generator behavior that omits constructors not requiring an HttpClient parameter, and verify that regeneration no longer produces those constructors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100