swagger-api / swagger-api/swagger-codegen

[JAVA]Change to method names for codegen for Spring-Boot.

Open
#9,131 0 comments 0 reactions 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

Looks like the naming convention for methods has changed. Previously (about a month ago) when I would codegen, the methods on the controller matched the resource path defined in the API (ex /myMethod would result in a method name of myMethod(). Now the method names are appended with the HTTP verb so /myMethod is generated as myMethodPost(). So this obviously will break our CI/CD flow if we ever have to go back and codegen from SwaggerHub.

Is this a bug or an intended change?

Swagger-codegen version

This is the codegen version used in SwaggerHub. Using openapi v3.

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Either

  1. make it optional to append the verb to the method name
  2. generate the method name from some specific declaration in the yaml (ex tag)
  3. revert back to the previous generation naming convention.

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 Spring-Boot Java generator and reproduce the reported change from a minimal OpenAPI v3 definition, comparing a path such as /myMethod with the generated controller method name. The issue provides no declaration, command, file, or test; done would require establishing the intended naming convention and adding coverage for the selected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend-api-design, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.