File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
java/io/swagger/codegen/v3/generators/handlebars
resources/handlebars/Java Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,15 @@ public String toLowerCase(String string) {
24
24
return string .toLowerCase ();
25
25
}
26
26
27
+ public String toQuotedWord (Object object ) {
28
+ String string = object .toString ();
29
+ if (string .contains ("\" " )) {
30
+ return string ;
31
+ } else {
32
+ return "\" " + string + "\" " ;
33
+ }
34
+ }
35
+
27
36
public String backSlash () {
28
37
return "\\ " ;
29
38
}
Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ import com.google.gson.stream.JsonWriter;
19
19
public enum { {#datatypeWithEnum} }{ {{.} }}{ {/datatypeWithEnum} }{ {^datatypeWithEnum} }{ {{classname} }}{ {/datatypeWithEnum} } {
20
20
{{#allowableValues} }
21
21
{ {#enumVars} }
22
+ { {#gson} }
23
+ { {#value} }
24
+ @SerializedName({ {{toQuotedWord value} }})
25
+ { {/value} }
26
+ { {/gson} }
22
27
{ {{name} }}({ {#value} }{ {{value} }}{ {/value} }{ {^value} }null{ {/value} }){ {^@last} },{ {/@last} }{ {#@last} };{ {/@last} }
23
28
{ {/enumVars} }
24
29
{ {/allowableValues} }
Original file line number Diff line number Diff line change 5
5
public enum { {#datatypeWithEnum} }{ {{.} }}{ {/datatypeWithEnum} }{ {^datatypeWithEnum} }{ {classname} }{ {/datatypeWithEnum} } {
6
6
{{#allowableValues} }
7
7
{ {#enumVars} }
8
+ { {#gson} }
9
+ { {#value} }
10
+ @SerializedName({ {{toQuotedWord value} }})
11
+ { {/value} }
12
+ { {/gson} }
8
13
{ {{name} }}({ {#value} }{ {{value} }}{ {/value} }{ {^value} }null{ {/value} }){ {^@last} },{ {/@last} }{ {#@last} };{ {/@last} }
9
14
{ {/enumVars} }
10
15
{ {/allowableValues} }
You can’t perform that action at this time.
0 commit comments