OpenAPITools / OpenAPITools/openapi-generator
[REQ][csharp-netcore] Extract fixed Client code bits to library
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Problem
Within one of my services, I access multiple APIs. When generating code for these APIs, a Client package is generated for each of them. This package contains classes that only vary in a few comment lines and default values for Configuration parameters. We end up with many classes/interfaces such as HttpMethod, that are isomorphic yet incompatible across Client packages.
Proposal
- Put the
Clientpackage under a fixed package (OpenAPI?) instead of the parameterised one. - Extract that package into a library and eliminate it as part of the code-generation output
- Import the library from the generated project file
- Generate a
[API]Configurationclass that extends the currentClient.Configurationclass and provides the generated defaults for the upper class, such asbasePath.
Alternatively
- Introduce a separate
clientPackagecode-gen parameter that allows overriding the package where theClientfiles will be placed - Eliminate the API specific comments in
Clientpackage, as well as the default values in theConfigurationclass - Generate a
[API]Configurationclass that extends${clientPackage}.Configurationclass and provides the generated defaults for the upper class, such asbasePath.
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 by examining the C#/.NET Core generator output, focusing on the generated Client package, its Configuration class, and the generated project file. Compare the proposed fixed-library and clientPackage alternatives, then define completion as shared fixed Client code, generated API-specific configuration defaults, and correct library imports without duplicating Client code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100