swagger-api / swagger-api/swagger-codegen

[JAVA] swagger-codegen-maven-plugin: generating inconsistent file and class names for endpoint path with a dash in it

Open
#12,143 1 comment 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

I have a .yaml Open API file for which I want to generate Java classes with the swagger-codegen-maven-plugin.

In the .yaml file there is a path /contracts-documents for which swagger-codegen generates the class ContractsdocumentsBody which is placed in the file ContractsDocumentsBody.java which doesn't compile because of the case inconsistency in the file/class names.

Swagger-codegen version

swagger-codegen-maven-plugin 3.0.41

Swagger declaration file content or url
paths:
   /contracts-documents:
Suggest a fix/enhancement

I'd expect both class name and file to have the same case.

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

Reproduce the issue with swagger-codegen-maven-plugin 3.0.41 using the provided YAML path /contracts-documents and Java generation. Trace how the endpoint name becomes ContractsdocumentsBody versus ContractsDocumentsBody, then verify that the generated class name and Java filename use matching case and compile successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.