Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #9719
Closed
Open
Issue created Jun 08, 2021 by Administrator@rootContributor

[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:

  1. Delimiter - allowing the user to choose which delimiter to use. The default should be underscore
  2. 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

Assignee
Assign to
Time tracking