mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 19:33:55 +00:00
Fixing broken enumeration swagger/json types for JaxRS-CXF templates.
This commit is contained in:
parent
c624311cab
commit
d45d36d8a2
@ -3,6 +3,10 @@ package {{package}};
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
|
@ -1,16 +1,23 @@
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
@XmlType(name="{{classname}}")
|
||||
@XmlType(name="{{datatypeWithEnum}}")
|
||||
@XmlEnum
|
||||
public enum {{classname}} {
|
||||
{{#allowableValues}}{{.}}{{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/allowableValues}}
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
public enum {{datatypeWithEnum}} {
|
||||
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}{{name}}({{datatype}}.valueOf("{{value}}")){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
|
||||
|
||||
private {{datatype}} value;
|
||||
|
||||
{{datatypeWithEnum}} ({{datatype}} v) {
|
||||
value = v;
|
||||
}
|
||||
|
||||
public static {{classname}} fromValue(String v) {
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static {{datatypeWithEnum}} fromValue(String v) {
|
||||
return valueOf(v);
|
||||
}
|
||||
}
|
@ -3,9 +3,10 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
{{#hasVars}} @XmlType(name = "{{classn,ame}}", propOrder =
|
||||
{{#hasVars}} @XmlType(name = "{{classname}}", propOrder =
|
||||
{ {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}}
|
||||
}){{/hasVars}}
|
||||
{{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}}
|
||||
|
Loading…
Reference in New Issue
Block a user