swagger-api / swagger-api/swagger-codegen

[Java] Issue with code generation

Open
#10,943 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

Code is not generated properly.

Content.java file contains wrong class definitions:
@JsonSubTypes({
@JsonSubTypes.Type(value = textMessage.class, name = "text"),
@JsonSubTypes.Type(value = carouselMessage.class, name = "carousel"),
@JsonSubTypes.Type(value = fileMessage.class, name = "file"),
@JsonSubTypes.Type(value = formMessage.class, name = "form"),
@JsonSubTypes.Type(value = formResponseMessage.class, name = "formResponse"),
@JsonSubTypes.Type(value = imageMessage.class, name = "image"),
@JsonSubTypes.Type(value = listMessage.class, name = "list"),
@JsonSubTypes.Type(value = locationMessage.class, name = "location"),
@JsonSubTypes.Type(value = templateMessage.class, name = "template"),
})
they should be capital letter class names

Swagger-codegen version

3.0.25

Swagger declaration file content or url

OpenApi file: https://github.com/zendesk/sunshine-conversations-api-spec/blob/master/openapi.yaml

Command line used for generation

java -jar swagger-codegen-cli.jar generate -i openapi.yaml -l "spring"

Steps to reproduce

just generate sources

Related issues/PRs
Suggest a fix/enhancement

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 generation using the linked OpenAPI file and the documented swagger-codegen 3.0.25 command with the spring generator. Inspect the generated Content.java definitions and the generator templates or entry points responsible for these names; done means the generated class names begin with capital letters.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.