swagger-api / swagger-api/swagger-codegen

[Go] Ability to remove class prefix from methods?

Open
#11,978 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

When generating Go code for swagger openAPI 3.0, the Go methods contain the class names as a prefix.
Is there a way to remove those? e.g.

func (a *ProgramUpdatesApiService) ProgramUpdatesDelete() { ... }

vs

func (a *ProgramUpdatesApiService) Delete() { ... }
Swagger-codegen version

3.0.36

Command line used for generation
swagger-codegen generate -i foo.com/swagger.json -l go -o subdirectory/ --model-package model --api-package api --invoker-package generated

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Go generation invoked by swagger-codegen generate and compare the generated ProgramUpdatesApiService methods with the naming examples in the issue. Establish how the requested prefix removal should be exposed; done when the generator can produce Delete() instead of ProgramUpdatesDelete() without changing the existing default.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, openapi
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.