From 6bf84d5fa741fb2440e25c58cd24bcef3f4fccaf Mon Sep 17 00:00:00 2001 From: Alessio Fachechi Date: Sat, 20 Jan 2018 07:05:32 +0100 Subject: [PATCH] fix of issue #7386 (#7401) --- .../src/main/resources/JavaJaxRS/spec/enumClass.mustache | 2 ++ 1 file changed, 2 insertions(+) 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)) {