[BUG][JAVA-Spring] Enum without value getter
Created by: bilak
Description
Generated enum class is missing getter for it's value. Is there any option with which I can turn on getter generation? Method toString is sufficient for String enums, but if I want numbered values it's annoying to convert values between different types.
openapi-generator version
3.3.4 openapi-generator-maven-plugin
OpenAPI declaration file content or url
components:
schemas:
QueueStatus:
type: integer
enum:
- 1
- 10
- 100
- 1000
x-enum-varnames:
- EDITABLE
- DELETABLE
- LOCK
- SPECIAL
Command line used for generation
mvn clean install
Generated output class
public enum QueueStatus {
EDITABLE(1),
DELETABLE(10),
LOCK(100),
SPECIAL(1000);
private Integer value;
QueueStatus(Integer value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static QueueStatus fromValue(String text) {
for (QueueStatus b : QueueStatus.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}