OpenAPITools / OpenAPITools/openapi-generator
Add switch to suppress auto-insertion of operationIndex [csharp-netcore]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Since version 6.0.0 an optional parameter operationIndex is being automatically added to all calls in csharp-netcore - and possibly other* - client side SDK code.
Eg
/// <summary>Get a list of lists.</summary>
/// <param name="listType">The type of list to return.</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>CollectionOfList</returns>
public CollectionOfList GetLists(string listType, int operationIndex = 0);
This behavior persists in version 6.0.1.
I can't find any reference to this in the changes for 6.0.0, or anywhere other a very brief comment in https://github.com/OpenAPITools/openapi-generator/pull/12090.
This a problem for us as it adds a parameter that is likely to confuse users of the third-party consumed .NET Standard 2.0 class library we generate from nearly 20 lengthy OpenAPI documents on a regular basis.
Assuming this behavior is intentional (ie, not a bug), we would like to see a configuration switch - eg, suppressOperationIndexes (default true) - to suppress the creation of these parameters. (Personally, I think it should really be addOperationIndexes (default false) but that's just an opinion based on previous version behavior.)
We have the option of using scripts to post-process the generated code but this is laborious to maintain and shouldn't really be necessary (IMHO).
* Tested version 6.0.1 with csharp and operationIndex is not added to the SDK.
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 tracing where the csharp-netcore generator adds the operationIndex parameter, then review the behavior introduced around pull request 12090 and compare it with csharp generation. Done means a configuration switch can suppress the automatically generated parameter for csharp-netcore without affecting the existing opt-in behavior; verify the generated SDK output for both settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100