swagger-api / swagger-api/swagger-codegen
PROBLEM GENERATING java ENUM FROM api
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
when requesting the generation of the java files, the generated enums class are not valid.
here is an exemple of the enum generated.
`public enum CarType {
MOTO("moto"),
CAR("car"),
MONOSPACE("monospace"),
UTILITAIRE("utilitaire");
private value;
CarType( value) {
this.value = value;
}`
--> THE CONSTRUCTOR TAKES A PARAMETER BUT THE TYPE IS NOT SET
--> THE ENUM CONTAINS AN ATTRIBUTE "value" but there is no type... (it should be String
Swagger-codegen version
problem exists with
2.2.3
2.2.2
Swagger declaration file content or url
here is the JSON file that describe my API. (and I would like to use swagger-codegen to generate a java client). YOU MUST DOWNLOAD THE FILE NOT PUT THE HTTP in the command line to reproduce the problem
https://drive.google.com/file/d/0B_RnGS1cOiu6V0FmWlNtUDZJN0k/view?usp=sharing
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i downloadedApi.json -l java -o javaApi
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Download the referenced API description as downloadedApi.json and rerun the stated swagger-codegen Java command. Inspect the generated CarType enum and trace the Java generation entry point or template responsible for its constructor and value field; done means the generated enum declares the parameter and value types so the Java client is valid.
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