forked from loafle/openapi-generator-original
added vendor extensions on parameters per #1173
This commit is contained in:
parent
b099d1e7a2
commit
5940f46f56
@ -13,6 +13,8 @@ public class CodegenParameter {
|
|||||||
public boolean isEnum;
|
public boolean isEnum;
|
||||||
public List<String> _enum;
|
public List<String> _enum;
|
||||||
public Map<String, Object> allowableValues;
|
public Map<String, Object> allowableValues;
|
||||||
|
public Map<String, Object> vendorExtensions;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether this parameter is mandatory. If the parameter is in "path",
|
* Determines whether this parameter is mandatory. If the parameter is in "path",
|
||||||
@ -50,6 +52,7 @@ public class CodegenParameter {
|
|||||||
if (this.allowableValues != null) {
|
if (this.allowableValues != null) {
|
||||||
output.allowableValues = new HashMap<String, Object>(this.allowableValues);
|
output.allowableValues = new HashMap<String, Object>(this.allowableValues);
|
||||||
}
|
}
|
||||||
|
output.vendorExtensions = this.vendorExtensions;
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
@ -674,7 +674,102 @@ public class DefaultCodegen {
|
|||||||
property.allowableValues = allowableValues;
|
property.allowableValues = allowableValues;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(p instanceof IntegerProperty) {
|
||||||
|
IntegerProperty sp = (IntegerProperty) p;
|
||||||
|
if(sp.getEnum() != null) {
|
||||||
|
List<Integer> _enum = sp.getEnum();
|
||||||
|
property._enum = new ArrayList<String>();
|
||||||
|
for(Integer i : _enum) {
|
||||||
|
property._enum.add(i.toString());
|
||||||
|
}
|
||||||
|
property.isEnum = true;
|
||||||
|
|
||||||
|
// legacy support
|
||||||
|
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||||
|
allowableValues.put("values", _enum);
|
||||||
|
property.allowableValues = allowableValues;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(p instanceof LongProperty) {
|
||||||
|
LongProperty sp = (LongProperty) p;
|
||||||
|
if(sp.getEnum() != null) {
|
||||||
|
List<Long> _enum = sp.getEnum();
|
||||||
|
property._enum = new ArrayList<String>();
|
||||||
|
for(Long i : _enum) {
|
||||||
|
property._enum.add(i.toString());
|
||||||
|
}
|
||||||
|
property.isEnum = true;
|
||||||
|
|
||||||
|
// legacy support
|
||||||
|
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||||
|
allowableValues.put("values", _enum);
|
||||||
|
property.allowableValues = allowableValues;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(p instanceof DoubleProperty) {
|
||||||
|
DoubleProperty sp = (DoubleProperty) p;
|
||||||
|
if(sp.getEnum() != null) {
|
||||||
|
List<Double> _enum = sp.getEnum();
|
||||||
|
property._enum = new ArrayList<String>();
|
||||||
|
for(Double i : _enum) {
|
||||||
|
property._enum.add(i.toString());
|
||||||
|
}
|
||||||
|
property.isEnum = true;
|
||||||
|
|
||||||
|
// legacy support
|
||||||
|
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||||
|
allowableValues.put("values", _enum);
|
||||||
|
property.allowableValues = allowableValues;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(p instanceof FloatProperty) {
|
||||||
|
FloatProperty sp = (FloatProperty) p;
|
||||||
|
if(sp.getEnum() != null) {
|
||||||
|
List<Float> _enum = sp.getEnum();
|
||||||
|
property._enum = new ArrayList<String>();
|
||||||
|
for(Float i : _enum) {
|
||||||
|
property._enum.add(i.toString());
|
||||||
|
}
|
||||||
|
property.isEnum = true;
|
||||||
|
|
||||||
|
// legacy support
|
||||||
|
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||||
|
allowableValues.put("values", _enum);
|
||||||
|
property.allowableValues = allowableValues;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(p instanceof DateProperty) {
|
||||||
|
DateProperty sp = (DateProperty) p;
|
||||||
|
if(sp.getEnum() != null) {
|
||||||
|
List<String> _enum = sp.getEnum();
|
||||||
|
property._enum = new ArrayList<String>();
|
||||||
|
for(String i : _enum) {
|
||||||
|
property._enum.add(i.toString());
|
||||||
|
}
|
||||||
|
property.isEnum = true;
|
||||||
|
|
||||||
|
// legacy support
|
||||||
|
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||||
|
allowableValues.put("values", _enum);
|
||||||
|
property.allowableValues = allowableValues;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(p instanceof DateTimeProperty) {
|
||||||
|
DateTimeProperty sp = (DateTimeProperty) p;
|
||||||
|
if(sp.getEnum() != null) {
|
||||||
|
List<String> _enum = sp.getEnum();
|
||||||
|
property._enum = new ArrayList<String>();
|
||||||
|
for(String i : _enum) {
|
||||||
|
property._enum.add(i.toString());
|
||||||
|
}
|
||||||
|
property.isEnum = true;
|
||||||
|
|
||||||
|
// legacy support
|
||||||
|
Map<String, Object> allowableValues = new HashMap<String, Object>();
|
||||||
|
allowableValues.put("values", _enum);
|
||||||
|
property.allowableValues = allowableValues;
|
||||||
|
}
|
||||||
|
}
|
||||||
property.datatype = getTypeDeclaration(p);
|
property.datatype = getTypeDeclaration(p);
|
||||||
|
|
||||||
// this can cause issues for clients which don't support enums
|
// this can cause issues for clients which don't support enums
|
||||||
@ -1033,6 +1128,8 @@ public class DefaultCodegen {
|
|||||||
p.defaultValue = ((FormParameter) param).getDefaultValue();
|
p.defaultValue = ((FormParameter) param).getDefaultValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.vendorExtensions = param.getVendorExtensions();
|
||||||
|
|
||||||
if (param instanceof SerializableParameter) {
|
if (param instanceof SerializableParameter) {
|
||||||
SerializableParameter qp = (SerializableParameter) param;
|
SerializableParameter qp = (SerializableParameter) param;
|
||||||
Property property = null;
|
Property property = null;
|
||||||
|
4
pom.xml
4
pom.xml
@ -502,10 +502,10 @@
|
|||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<properties>
|
<properties>
|
||||||
<swagger-parser-version>1.0.10</swagger-parser-version>
|
<swagger-parser-version>1.0.11-SNAPSHOT</swagger-parser-version>
|
||||||
<scala-version>2.11.1</scala-version>
|
<scala-version>2.11.1</scala-version>
|
||||||
<felix-version>2.3.4</felix-version>
|
<felix-version>2.3.4</felix-version>
|
||||||
<swagger-core-version>1.5.3</swagger-core-version>
|
<swagger-core-version>1.5.4-SNAPSHOT</swagger-core-version>
|
||||||
<scala-test-version>2.1.4</scala-test-version>
|
<scala-test-version>2.1.4</scala-test-version>
|
||||||
<commons-io-version>2.3</commons-io-version>
|
<commons-io-version>2.3</commons-io-version>
|
||||||
<commons-cli-version>1.2</commons-cli-version>
|
<commons-cli-version>1.2</commons-cli-version>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user