swagger-api / swagger-api/swagger-codegen

[JAVA] Case changes in generated class names since 0cf82d7

Open
#7,938 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

Older versions of the retrofit2 generator (2.3.0-SNAPSHOT, possibly earlier) followed the tag case when generating class names, e.g.: AWS Regions -> AWSRegionsApi, AWSRegionsApiTest. As of 2.3.0 this is no longer the case, and class names are more aggressively camel-cased: AwsRegionsApi. Should this be considered a bug?

Swagger-codegen version

2.3.0

Swagger declaration file content or url
swagger: '2.0'
info:
  title: example
  version: 1.0.0
host: 'localhost:8080'
schemes:
  - http
basePath: /
produces:
  - application/json
consumes:
  - application/json
securityDefinitions:
  basic:
    type: basic
security:
  - basic: []
paths:
  /aws-regions:
    get:
      summary: List AWS regions
      operationId: getAwsRegions
      tags:
        - AWS Regions
      responses:
        200:
          description: List of AWS regions supported
          schema:
            type: array
            items:
              $ref: '#/definitions/AwsRegion'
definitions:
  AwsRegion:
    type: object
Command line used for generation
java -jar $HOME/.m2/repository/io/swagger/swagger-codegen-cli/2.3.0/swagger-codegen-cli-2.3.0.jar -i swagger.yml -l java -o . -c codegen.json
{
    "groupId": "com.example",
    "artifactId": "foo-http-client",
    "artifactVersion": "0.0.1-SNAPSHOT",
    "modelPackage": "com.example.httpclient.models",
    "apiPackage": "com.example.httpclient.api",
    "invokerPackage": "com.example.httpclient",
    "serializableModel": true,
    "library": "retrofit2",
    "dateLibrary": "joda",
    "hideGenerationTimestamp": true
}
Related issues/PRs

The change has been introduced by commit 0cf82d7, PR #6399.

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 by reviewing commit 0cf82d7 and related PR #6399, then reproduce Java retrofit2 generation with the supplied Swagger YAML and command. Compare the generated class names with the older 2.3.0-SNAPSHOT behavior; done requires a decided, documented naming expectation and corresponding project changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.