[REQ] operationId: Allow getting only the method name
Created by: ygalblum
Is your feature request related to a problem? Please describe.
I have an OpenAPI server based on Python Connexion (https://github.com/zalando/connexion). Since this is a Python module the operationId fields take the form of "package_name.api.module_name.method". For example, the operationId for the "/users" GET operation will be "my_server.api.users.get". As a result, the Go code generator will create an service called UsersApiService that will have a method called MyServerApiUsersGet. To me, this name has a lot of unneeded sections. The Python package name is obviously not needed, the word Api is not needed and also the Service name is not needed since the method is already inside a service with that name. So, instead, I would like to have the method be just "get". Please do not focus on this specific "GET" operation, the naming could be anything.
Describe the solution you'd like
Today, the code generator allows removing the prefix, but it assumes the delimiter is an underscore and takes everything after the first one. In my case, the delimiter is a period and I would like to get everything after the last one.
So, I would like to suggest broadening this option by adding two configuration fields:
- Delimiter - allowing the user to choose which delimiter to use. The default should be underscore
- Count - The X occurrence of the delimiter that constitutes a prefix. The default should be 1 and -1 should be used for last
Describe alternatives you've considered
I saw your comment about using templates. But, since this change relates to all languages, I think my suggestion is the way to go