Open GimpArm opened 3 years ago
If there are duplicate OperationIds
If this is the case then it's an invalid spec (operation IDs must be unique within the document).
I made a simple POC by creating a new IOperationNameGenerator although I'm not sure this is the correct route since it most certainly doesn't work properly for TypeScript.
This is the idea with this interface, you can customize it to your liking. In Open API you should avoid overloading based on parameters, JS/JSON/web APIs are not really compatible with these OO languages.
Is there a way to inject my own IOperationNameGenerator without having to compile my own version?
If there are duplicate OperationIds but they have different parameter signatures, then it currently just blindly appends a number to the end. It would be nice to have an option to just not do that. Allow for generating with duplicate names and whether this results in valid code or not is up to the developer. (There are already many options if incorrectly applied result in invalid code). I think the current strategy of simply appending a number to the end of the name is not sustainable since there is no control over what the number is. If the API has a new overload between 1 & 2 then the numbers are shifted and all clients immediately break or worse can call the wrong method.
I made a simple POC by creating a new IOperationNameGenerator although I'm not sure this is the correct route since it most certainly doesn't work properly for TypeScript.
Note: If
SingleClientFromPathSegments
is used it will actually allow overloads after it applies the HTTP Method to the end, since there is no further check for duplicate. So there will be multiple ControllMyMethodGet() methods generated with parameter overloading.