diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/enumClass.mustache index a9d67c0471e6..4589ba05c29b 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/enumClass.mustache @@ -16,10 +16,12 @@ public enum {{datatypeWithEnum}} { } @Override + @JsonValue public String toString() { return String.valueOf(value); } + @JsonCreator public static {{datatypeWithEnum}} fromValue(String v) { for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { if (String.valueOf(b.value).equals(v)) {