I have the following Swagger definition, which I expect swagger-codegen to create a Java Enum class. I was looking through the swagger forums, and it looks like swagger-codegen should generate the correct Java code.
"definitions": {
"AnalystScoreEnum": {
"type": "string",
"enum": [
"POOR",
"AVERAGE"
]
}
}
What comes from swagger-codegen:
package io.swagger.client.model;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
@ApiModel(description = "")
public class AnalystScoreEnum {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnalystScoreEnum {\n");
sb.append("}\n");
return sb.toString();
}
}
What I expect / want is the following:
public enum AnalystScoresEnum {
POOR(1),
AVERAGE(2)
private int value;
private AnalystScoresEnum(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
source
share