forked from loafle/openapi-generator-original
Merge branch 'master' of https://github.com/swagger-api/swagger-codegen
This commit is contained in:
commit
a98c58a76f
@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l javascript -o samples/client/petstore/javascript"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l javascript -o samples/client/petstore/javascript"
|
||||
|
||||
java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -20,7 +20,7 @@ public class CodegenModel {
|
||||
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
|
||||
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
|
||||
public List<CodegenProperty> allVars;
|
||||
public List<String> allowableValues;
|
||||
public Map<String, Object> allowableValues;
|
||||
|
||||
// Sorted sets of required parameters.
|
||||
public Set<String> mandatory = new TreeSet<String>();
|
||||
|
@ -133,6 +133,161 @@ public class DefaultCodegen {
|
||||
return objs;
|
||||
}
|
||||
|
||||
/**
|
||||
* post process enum defined in model's properties
|
||||
*
|
||||
* @param objs Map of models
|
||||
* @return maps of models with better enum support
|
||||
*/
|
||||
public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
|
||||
List<Object> models = (List<Object>) objs.get("models");
|
||||
for (Object _mo : models) {
|
||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||
|
||||
// for enum model
|
||||
if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) {
|
||||
Map<String, Object> allowableValues = cm.allowableValues;
|
||||
|
||||
List<Object> values = (List<Object>) allowableValues.get("values");
|
||||
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
||||
String commonPrefix = findCommonPrefixOfVars(values);
|
||||
int truncateIdx = commonPrefix.length();
|
||||
for (Object value : values) {
|
||||
Map<String, String> enumVar = new HashMap<String, String>();
|
||||
String enumName;
|
||||
if (truncateIdx == 0) {
|
||||
enumName = value.toString();
|
||||
} else {
|
||||
enumName = value.toString().substring(truncateIdx);
|
||||
if ("".equals(enumName)) {
|
||||
enumName = value.toString();
|
||||
}
|
||||
}
|
||||
enumVar.put("name", toEnumVarName(enumName, cm.dataType));
|
||||
enumVar.put("value", toEnumValue(value.toString(), cm.dataType));
|
||||
enumVars.add(enumVar);
|
||||
}
|
||||
cm.allowableValues.put("enumVars", enumVars);
|
||||
}
|
||||
|
||||
// for enum model's properties
|
||||
for (CodegenProperty var : cm.vars) {
|
||||
Map<String, Object> allowableValues = var.allowableValues;
|
||||
|
||||
// handle ArrayProperty
|
||||
if (var.items != null) {
|
||||
allowableValues = var.items.allowableValues;
|
||||
}
|
||||
|
||||
if (allowableValues == null) {
|
||||
continue;
|
||||
}
|
||||
//List<String> values = (List<String>) allowableValues.get("values");
|
||||
List<Object> values = (List<Object>) allowableValues.get("values");
|
||||
if (values == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// put "enumVars" map into `allowableValues", including `name` and `value`
|
||||
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
||||
String commonPrefix = findCommonPrefixOfVars(values);
|
||||
int truncateIdx = commonPrefix.length();
|
||||
for (Object value : values) {
|
||||
Map<String, String> enumVar = new HashMap<String, String>();
|
||||
String enumName;
|
||||
if (truncateIdx == 0) {
|
||||
enumName = value.toString();
|
||||
} else {
|
||||
enumName = value.toString().substring(truncateIdx);
|
||||
if ("".equals(enumName)) {
|
||||
enumName = value.toString();
|
||||
}
|
||||
}
|
||||
enumVar.put("name", toEnumVarName(enumName, var.datatype));
|
||||
enumVar.put("value", toEnumValue(value.toString(), var.datatype));
|
||||
enumVars.add(enumVar);
|
||||
}
|
||||
allowableValues.put("enumVars", enumVars);
|
||||
// handle default value for enum, e.g. available => StatusEnum.AVAILABLE
|
||||
if (var.defaultValue != null) {
|
||||
String enumName = null;
|
||||
for (Map<String, String> enumVar : enumVars) {
|
||||
if (toEnumValue(var.defaultValue, var.datatype).equals(enumVar.get("value"))) {
|
||||
enumName = enumVar.get("name");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (enumName != null) {
|
||||
var.defaultValue = toEnumDefaultValue(enumName, var.datatypeWithEnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the common prefix of variables for enum naming
|
||||
*
|
||||
* @param vars List of variable names
|
||||
* @return the common prefix for naming
|
||||
*/
|
||||
public String findCommonPrefixOfVars(List<Object> vars) {
|
||||
try {
|
||||
String[] listStr = vars.toArray(new String[vars.size()]);
|
||||
|
||||
String prefix = StringUtils.getCommonPrefix(listStr);
|
||||
// exclude trailing characters that should be part of a valid variable
|
||||
// e.g. ["status-on", "status-off"] => "status-" (not "status-o")
|
||||
return prefix.replaceAll("[a-zA-Z0-9]+\\z", "");
|
||||
} catch (ArrayStoreException e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the enum default value in the language specifed format
|
||||
*
|
||||
* @param value enum variable name
|
||||
* @param datatype data type
|
||||
* @return the default value for the enum
|
||||
*/
|
||||
public String toEnumDefaultValue(String value, String datatype) {
|
||||
return datatype + "." + value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the enum value in the language specifed format
|
||||
* e.g. status becomes "status"
|
||||
*
|
||||
* @param value enum variable name
|
||||
* @param datatype data type
|
||||
* @return the sanitized value for enum
|
||||
*/
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("number".equalsIgnoreCase(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\"" + escapeText(value) + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the sanitized variable name for enum
|
||||
*
|
||||
* @param value enum variable name
|
||||
* @param datatype data type
|
||||
* @return the sanitized variable name for enum
|
||||
*/
|
||||
public String toEnumVarName(String value, String datatype) {
|
||||
String var = value.replaceAll("\\W+", "_").toUpperCase();
|
||||
if (var.matches("\\d.*")) {
|
||||
return "_" + var;
|
||||
} else {
|
||||
return var;
|
||||
}
|
||||
}
|
||||
|
||||
// override with any special post-processing
|
||||
@SuppressWarnings("static-method")
|
||||
@ -456,7 +611,7 @@ public class DefaultCodegen {
|
||||
/**
|
||||
* Return the Enum name (e.g. StatusEnum given 'status')
|
||||
*
|
||||
* @param property Codegen property object
|
||||
* @param property Codegen property
|
||||
* @return the Enum name
|
||||
*/
|
||||
@SuppressWarnings("static-method")
|
||||
@ -1012,7 +1167,9 @@ public class DefaultCodegen {
|
||||
ModelImpl impl = (ModelImpl) model;
|
||||
if(impl.getEnum() != null && impl.getEnum().size() > 0) {
|
||||
m.isEnum = true;
|
||||
m.allowableValues = impl.getEnum();
|
||||
// comment out below as allowableValues is not set in post processing model enum
|
||||
m.allowableValues = new HashMap<String, Object>();
|
||||
m.allowableValues.put("values", impl.getEnum());
|
||||
Property p = PropertyBuilder.build(impl.getType(), impl.getFormat(), null);
|
||||
m.dataType = getSwaggerType(p);
|
||||
}
|
||||
@ -1144,7 +1301,8 @@ public class DefaultCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
if (p instanceof BaseIntegerProperty) {
|
||||
// type is integer and without format
|
||||
if (p instanceof BaseIntegerProperty && !(p instanceof IntegerProperty) && !(p instanceof LongProperty)) {
|
||||
BaseIntegerProperty sp = (BaseIntegerProperty) p;
|
||||
property.isInteger = true;
|
||||
/*if (sp.getEnum() != null) {
|
||||
@ -1210,7 +1368,8 @@ public class DefaultCodegen {
|
||||
property.isByteArray = true;
|
||||
}
|
||||
|
||||
if (p instanceof DecimalProperty) {
|
||||
// type is number and without format
|
||||
if (p instanceof DecimalProperty && !(p instanceof DoubleProperty) && !(p instanceof FloatProperty)) {
|
||||
DecimalProperty sp = (DecimalProperty) p;
|
||||
property.isFloat = true;
|
||||
/*if (sp.getEnum() != null) {
|
||||
|
@ -203,11 +203,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
return StringUtils.capitalize(property.name) + "Enum?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
List<Object> models = (List<Object>) objs.get("models");
|
||||
@ -223,7 +218,8 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
// process enum in models
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -544,4 +540,54 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
public void setSourceFolder(String sourceFolder) {
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toEnumVarName(String name, String datatype) {
|
||||
String enumName = sanitizeName(name);
|
||||
|
||||
enumName = enumName.replaceFirst("^_", "");
|
||||
enumName = enumName.replaceFirst("_$", "");
|
||||
|
||||
enumName = camelize(enumName) + "Enum";
|
||||
|
||||
LOGGER.info("toEnumVarName = " + enumName);
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
return sanitizeName(camelize(property.name)) + "Enum";
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
String enumName = sanitizeName(property.name);
|
||||
if (!StringUtils.isEmpty(modelNamePrefix)) {
|
||||
enumName = modelNamePrefix + "_" + enumName;
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(modelNameSuffix)) {
|
||||
enumName = enumName + "_" + modelNameSuffix;
|
||||
}
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(enumName)) {
|
||||
LOGGER.warn(enumName + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + enumName));
|
||||
enumName = "model_" + enumName; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -231,4 +231,59 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\'" + escapeText(value) + "\'";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumDefaultValue(String value, String datatype) {
|
||||
return datatype + "_" + value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumVarName(String name, String datatype) {
|
||||
// number
|
||||
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||
String varName = new String(name);
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
return varName;
|
||||
}
|
||||
|
||||
// string
|
||||
String enumName = sanitizeName(underscore(name).toUpperCase());
|
||||
enumName = enumName.replaceFirst("^_", "");
|
||||
enumName = enumName.replaceFirst("_$", "");
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
String enumName = toModelName(property.name) + "Enum";
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
// process enum in models
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -308,75 +308,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objMap) {
|
||||
Map<String, Object> objs = super.postProcessModels(objMap);
|
||||
|
||||
List<Object> models = (List<Object>) objs.get("models");
|
||||
for (Object _mo : models) {
|
||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||
for (CodegenProperty var : cm.vars) {
|
||||
Map<String, Object> allowableValues = var.allowableValues;
|
||||
|
||||
// handle ArrayProperty
|
||||
if (var.items != null) {
|
||||
allowableValues = var.items.allowableValues;
|
||||
}
|
||||
|
||||
if (allowableValues == null) {
|
||||
continue;
|
||||
}
|
||||
List<String> values = (List<String>) allowableValues.get("values");
|
||||
if (values == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// put "enumVars" map into `allowableValues", including `name` and `value`
|
||||
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
||||
String commonPrefix = findCommonPrefixOfVars(values);
|
||||
int truncateIdx = commonPrefix.length();
|
||||
for (String value : values) {
|
||||
Map<String, String> enumVar = new HashMap<String, String>();
|
||||
String enumName;
|
||||
if (truncateIdx == 0) {
|
||||
enumName = value;
|
||||
} else {
|
||||
enumName = value.substring(truncateIdx);
|
||||
if ("".equals(enumName)) {
|
||||
enumName = value;
|
||||
}
|
||||
}
|
||||
enumVar.put("name", toEnumVarName(enumName));
|
||||
enumVar.put("jsonname", value);
|
||||
enumVar.put("value", value);
|
||||
enumVars.add(enumVar);
|
||||
}
|
||||
allowableValues.put("enumVars", enumVars);
|
||||
// handle default value for enum, e.g. available => StatusEnum.AVAILABLE
|
||||
|
||||
// HACK: strip ? from enum
|
||||
if (var.datatypeWithEnum != null) {
|
||||
var.vendorExtensions.put(DATA_TYPE_WITH_ENUM_EXTENSION, var.datatypeWithEnum.substring(0, var.datatypeWithEnum.length() - 1));
|
||||
}
|
||||
|
||||
if (var.defaultValue != null) {
|
||||
String enumName = null;
|
||||
|
||||
for (Map<String, String> enumVar : enumVars) {
|
||||
|
||||
if (var.defaultValue.replace("\"", "").equals(enumVar.get("value"))) {
|
||||
enumName = enumVar.get("name");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (enumName != null && var.vendorExtensions.containsKey(DATA_TYPE_WITH_ENUM_EXTENSION)) {
|
||||
var.defaultValue = var.vendorExtensions.get(DATA_TYPE_WITH_ENUM_EXTENSION) + "." + enumName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return objs;
|
||||
return super.postProcessModels(objMap);
|
||||
}
|
||||
|
||||
public void setTargetFramework(String dotnetFramework) {
|
||||
@ -436,18 +368,34 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
return codegenModel;
|
||||
}
|
||||
|
||||
private String findCommonPrefixOfVars(List<String> vars) {
|
||||
String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()]));
|
||||
// exclude trailing characters that should be part of a valid variable
|
||||
// e.g. ["status-on", "status-off"] => "status-" (not "status-o")
|
||||
return prefix.replaceAll("[a-zA-Z0-9]+\\z", "");
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("int?".equalsIgnoreCase(datatype) || "long?".equalsIgnoreCase(datatype) ||
|
||||
"double?".equalsIgnoreCase(datatype) || "float?".equalsIgnoreCase(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\"" + escapeText(value) + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
private String toEnumVarName(String value) {
|
||||
@Override
|
||||
public String toEnumVarName(String value, String datatype) {
|
||||
// number
|
||||
if ("int?".equals(datatype) || "long?".equals(datatype) ||
|
||||
"double?".equals(datatype) || "float?".equals(datatype)) {
|
||||
String varName = "NUMBER_" + value;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
return varName;
|
||||
}
|
||||
|
||||
// string
|
||||
String var = value.replaceAll("_", " ");
|
||||
var = WordUtils.capitalizeFully(var);
|
||||
var = var.replaceAll("\\W+", "");
|
||||
|
||||
|
||||
if (var.matches("\\d.*")) {
|
||||
return "_" + var;
|
||||
} else {
|
||||
|
@ -11,6 +11,7 @@ import io.swagger.models.parameters.Parameter;
|
||||
import io.swagger.models.properties.*;
|
||||
import org.apache.commons.lang.BooleanUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -652,6 +653,28 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return codegenModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
|
||||
objs = super.postProcessModelsEnum(objs);
|
||||
String lib = getLibrary();
|
||||
if (StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) {
|
||||
List<Map<String, String>> imports = (List<Map<String, String>>)objs.get("imports");
|
||||
List<Object> models = (List<Object>) objs.get("models");
|
||||
for (Object _mo : models) {
|
||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||
// for enum model
|
||||
if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) {
|
||||
cm.imports.add(importMapping.get("JsonValue"));
|
||||
Map<String, String> item = new HashMap<String, String>();
|
||||
item.put("import", importMapping.get("JsonValue"));
|
||||
imports.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||
if(serializeBigDecimalAsString) {
|
||||
@ -697,63 +720,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
List<Object> models = (List<Object>) objs.get("models");
|
||||
for (Object _mo : models) {
|
||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||
|
||||
for (CodegenProperty var : cm.vars) {
|
||||
Map<String, Object> allowableValues = var.allowableValues;
|
||||
|
||||
// handle ArrayProperty
|
||||
if (var.items != null) {
|
||||
allowableValues = var.items.allowableValues;
|
||||
}
|
||||
|
||||
if (allowableValues == null) {
|
||||
continue;
|
||||
}
|
||||
List<String> values = (List<String>) allowableValues.get("values");
|
||||
if (values == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// put "enumVars" map into `allowableValues", including `name` and `value`
|
||||
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
||||
String commonPrefix = findCommonPrefixOfVars(values);
|
||||
int truncateIdx = commonPrefix.length();
|
||||
for (String value : values) {
|
||||
Map<String, String> enumVar = new HashMap<String, String>();
|
||||
String enumName;
|
||||
if (truncateIdx == 0) {
|
||||
enumName = value;
|
||||
} else {
|
||||
enumName = value.substring(truncateIdx);
|
||||
if ("".equals(enumName)) {
|
||||
enumName = value;
|
||||
}
|
||||
}
|
||||
enumVar.put("name", toEnumVarName(enumName));
|
||||
enumVar.put("value", value);
|
||||
enumVars.add(enumVar);
|
||||
}
|
||||
allowableValues.put("enumVars", enumVars);
|
||||
// handle default value for enum, e.g. available => StatusEnum.AVAILABLE
|
||||
if (var.defaultValue != null) {
|
||||
String enumName = null;
|
||||
for (Map<String, String> enumVar : enumVars) {
|
||||
if (var.defaultValue.equals(enumVar.get("value"))) {
|
||||
enumName = enumVar.get("name");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (enumName != null) {
|
||||
var.defaultValue = var.datatypeWithEnum + "." + enumName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -849,16 +816,35 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected boolean needToImport(String type) {
|
||||
return super.needToImport(type) && type.indexOf(".") < 0;
|
||||
}
|
||||
|
||||
private static String findCommonPrefixOfVars(List<String> vars) {
|
||||
/*
|
||||
@Override
|
||||
public String findCommonPrefixOfVars(List<String> vars) {
|
||||
String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()]));
|
||||
// exclude trailing characters that should be part of a valid variable
|
||||
// e.g. ["status-on", "status-off"] => "status-" (not "status-o")
|
||||
return prefix.replaceAll("[a-zA-Z0-9]+\\z", "");
|
||||
}
|
||||
*/
|
||||
|
||||
private static String toEnumVarName(String value) {
|
||||
String var = value.replaceAll("\\W+", "_").toUpperCase();
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
return sanitizeName(camelize(property.name)) + "Enum";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumVarName(String value, String datatype) {
|
||||
// number
|
||||
if ("Integer".equals(datatype) || "Long".equals(datatype) ||
|
||||
"Float".equals(datatype) || "Double".equals(datatype)) {
|
||||
String varName = "NUMBER_" + value;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
return varName;
|
||||
}
|
||||
|
||||
// string
|
||||
String var = value.replaceAll("\\W+", "_").replaceAll("_+", "_").toUpperCase();
|
||||
if (var.matches("\\d.*")) {
|
||||
return "_" + var;
|
||||
} else {
|
||||
@ -866,6 +852,16 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("Integer".equals(datatype) || "Long".equals(datatype) ||
|
||||
"Float".equals(datatype) || "Double".equals(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\"" + escapeText(value) + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
|
||||
// This generator uses inline classes to define enums, which breaks when
|
||||
// dealing with models that have subTypes. To clean this up, we will analyze
|
||||
|
@ -871,7 +871,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
if (allowableValues == null) {
|
||||
continue;
|
||||
}
|
||||
List<String> values = (List<String>) allowableValues.get("values");
|
||||
List<Object> values = (List<Object>) allowableValues.get("values");
|
||||
if (values == null) {
|
||||
continue;
|
||||
}
|
||||
@ -880,19 +880,19 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
||||
String commonPrefix = findCommonPrefixOfVars(values);
|
||||
int truncateIdx = commonPrefix.length();
|
||||
for (String value : values) {
|
||||
for (Object value : values) {
|
||||
Map<String, String> enumVar = new HashMap<String, String>();
|
||||
String enumName;
|
||||
if (truncateIdx == 0) {
|
||||
enumName = value;
|
||||
enumName = value.toString();
|
||||
} else {
|
||||
enumName = value.substring(truncateIdx);
|
||||
enumName = value.toString().substring(truncateIdx);
|
||||
if ("".equals(enumName)) {
|
||||
enumName = value;
|
||||
enumName = value.toString();
|
||||
}
|
||||
}
|
||||
enumVar.put("name", toEnumVarName(enumName));
|
||||
enumVar.put("value", value);
|
||||
enumVar.put("name", toEnumVarName(enumName, var.datatype));
|
||||
enumVar.put("value",toEnumValue(value.toString(), var.datatype));
|
||||
enumVars.add(enumVar);
|
||||
}
|
||||
allowableValues.put("enumVars", enumVars);
|
||||
@ -929,22 +929,15 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
return !defaultIncludes.contains(type)
|
||||
&& !languageSpecificPrimitives.contains(type);
|
||||
}
|
||||
|
||||
private static String findCommonPrefixOfVars(List<String> vars) {
|
||||
/*
|
||||
@Override
|
||||
public String findCommonPrefixOfVars(List<String> vars) {
|
||||
String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()]));
|
||||
// exclude trailing characters that should be part of a valid variable
|
||||
// e.g. ["status-on", "status-off"] => "status-" (not "status-o")
|
||||
return prefix.replaceAll("[a-zA-Z0-9]+\\z", "");
|
||||
}
|
||||
|
||||
private static String toEnumVarName(String value) {
|
||||
String var = value.replaceAll("\\W+", "_").toUpperCase();
|
||||
if (var.matches("\\d.*")) {
|
||||
return "_" + var;
|
||||
} else {
|
||||
return var;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
|
||||
// This generator uses inline classes to define enums, which breaks when
|
||||
@ -1003,4 +996,41 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
return packageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
return sanitizeName(camelize(property.name)) + "Enum";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumVarName(String value, String datatype) {
|
||||
return value;
|
||||
/*
|
||||
// number
|
||||
if ("Integer".equals(datatype) || "Number".equals(datatype)) {
|
||||
String varName = "NUMBER_" + value;
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
return varName;
|
||||
}
|
||||
|
||||
// string
|
||||
String var = value.replaceAll("\\W+", "_").replaceAll("_+", "_").toUpperCase();
|
||||
if (var.matches("\\d.*")) {
|
||||
return "_" + var;
|
||||
} else {
|
||||
return var;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("Integer".equals(datatype) || "Number".equals(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\"" + escapeText(value) + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
@ -12,6 +13,7 @@ import io.swagger.models.properties.*;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.HashSet;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
@ -567,4 +569,57 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
p.example = example;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\'" + escapeText(value) + "\'";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumDefaultValue(String value, String datatype) {
|
||||
return datatype + "_" + value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumVarName(String name, String datatype) {
|
||||
// number
|
||||
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||
String varName = new String(name);
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
return varName;
|
||||
}
|
||||
|
||||
// string
|
||||
String enumName = sanitizeName(underscore(name).toUpperCase());
|
||||
enumName = enumName.replaceFirst("^_", "");
|
||||
enumName = enumName.replaceFirst("_$", "");
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
String enumName = underscore(toModelName(property.name)).toUpperCase();
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
// process enum in models
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
}
|
||||
|
@ -335,8 +335,10 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
swiftEnums.add(map);
|
||||
}
|
||||
codegenProperty.allowableValues.put("values", swiftEnums);
|
||||
codegenProperty.datatypeWithEnum =
|
||||
StringUtils.left(codegenProperty.datatypeWithEnum, codegenProperty.datatypeWithEnum.length() - "Enum".length());
|
||||
codegenProperty.datatypeWithEnum = toEnumName(codegenProperty);
|
||||
//codegenProperty.datatypeWithEnum =
|
||||
// StringUtils.left(codegenProperty.datatypeWithEnum, codegenProperty.datatypeWithEnum.length() - "Enum".length());
|
||||
|
||||
// Ensure that the enum type doesn't match a reserved word or
|
||||
// the variable name doesn't match the generated enum type or the
|
||||
// Swift compiler will generate an error
|
||||
@ -483,4 +485,59 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public void setResponseAs(String[] responseAs) {
|
||||
this.responseAs = responseAs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\'" + escapeText(value) + "\'";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumDefaultValue(String value, String datatype) {
|
||||
return datatype + "_" + value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumVarName(String name, String datatype) {
|
||||
// number
|
||||
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||
String varName = new String(name);
|
||||
varName = varName.replaceAll("-", "MINUS_");
|
||||
varName = varName.replaceAll("\\+", "PLUS_");
|
||||
varName = varName.replaceAll("\\.", "_DOT_");
|
||||
return varName;
|
||||
}
|
||||
|
||||
// string
|
||||
String enumName = sanitizeName(underscore(name).toUpperCase());
|
||||
enumName = enumName.replaceFirst("^_", "");
|
||||
enumName = enumName.replaceFirst("_$", "");
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toEnumName(CodegenProperty property) {
|
||||
String enumName = underscore(toModelName(property.name)).toUpperCase();
|
||||
|
||||
if (enumName.matches("\\d.*")) { // starts with number
|
||||
return "_" + enumName;
|
||||
} else {
|
||||
return enumName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
// process enum in models
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
|
||||
public enum {{{datatypeWithEnum}}} {
|
||||
{{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
private String value;
|
||||
|
||||
{{{datatypeWithEnum}}}(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
public enum {{classname}} {
|
||||
{{#allowableValues}}{{.}}{{^-last}}, {{/-last}}{{/allowableValues}}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
private {{datatype}} value;
|
||||
|
||||
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
public enum {{{datatypeWithEnum}}} {
|
||||
{{#allowableValues}}{{#enumVars}}@SerializedName("{{{value}}}")
|
||||
{{{name}}}("{{{value}}}"){{^-last}},
|
||||
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
private String value;
|
||||
|
||||
{{{datatypeWithEnum}}}(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
@ -4,4 +4,4 @@
|
||||
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
* `{{name}}` (value: `{{value}}`)
|
||||
{{#enumVars}}{{/allowableValues}}
|
||||
{{/enumVars}}{{/allowableValues}}
|
||||
|
@ -8,78 +8,7 @@ import com.google.gson.annotations.SerializedName;
|
||||
|
||||
{{#serializableModel}}import java.io.Serializable;{{/serializableModel}}
|
||||
{{#models}}
|
||||
|
||||
{{#model}}{{#description}}
|
||||
/**
|
||||
* {{description}}
|
||||
**/{{/description}}
|
||||
{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}
|
||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||
{{#vars}}{{#isEnum}}
|
||||
|
||||
{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
|
||||
{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}}
|
||||
@SerializedName("{{baseName}}")
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
||||
{{/vars}}
|
||||
|
||||
{{#vars}}
|
||||
/**{{#description}}
|
||||
* {{{description}}}{{/description}}{{#minimum}}
|
||||
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
||||
* maximum: {{maximum}}{{/maximum}}
|
||||
**/
|
||||
@ApiModelProperty({{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
return {{name}};
|
||||
}{{^isReadOnly}}
|
||||
public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
|
||||
this.{{name}} = {{name}};
|
||||
}{{/isReadOnly}}
|
||||
|
||||
{{/vars}}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}{{#hasVars}}
|
||||
{{classname}} {{classVarName}} = ({{classname}}) o;
|
||||
return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
|
||||
{{/hasMore}}{{/vars}}{{#parent}} &&
|
||||
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
||||
return true;{{/hasVars}}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class {{classname}} {\n");
|
||||
{{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
|
||||
{{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
|
||||
{{/vars}}sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
{{#model}}
|
||||
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
|
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{name}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
private {{dataType}} value;
|
||||
|
||||
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{dataType}} value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
private {{datatype}} value;
|
||||
|
||||
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/**
|
||||
* {{#description}}{{description}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||
*/{{#description}}
|
||||
@ApiModel(description = "{{{description}}}"){{/description}}
|
||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||
{{#vars}}{{#isEnum}}
|
||||
|
||||
{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
|
||||
{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}}
|
||||
@SerializedName("{{baseName}}")
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
||||
{{/vars}}
|
||||
|
||||
{{#vars}}
|
||||
/**{{#description}}
|
||||
* {{{description}}}{{/description}}{{#minimum}}
|
||||
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
||||
* maximum: {{maximum}}{{/maximum}}
|
||||
**/
|
||||
@ApiModelProperty({{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
return {{name}};
|
||||
}{{^isReadOnly}}
|
||||
public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
|
||||
this.{{name}} = {{name}};
|
||||
}{{/isReadOnly}}
|
||||
|
||||
{{/vars}}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}{{#hasVars}}
|
||||
{{classname}} {{classVarName}} = ({{classname}}) o;
|
||||
return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
|
||||
{{/hasMore}}{{/vars}}{{#parent}} &&
|
||||
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
||||
return true;{{/hasVars}}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class {{classname}} {\n");
|
||||
{{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
|
||||
{{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
|
||||
{{/vars}}sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
@ -17,9 +17,9 @@ import com.google.gson.annotations.SerializedName;
|
||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||
{{#vars}}{{#isEnum}}
|
||||
|
||||
{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
|
||||
{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}}
|
||||
{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}}
|
||||
@SerializedName("{{baseName}}")
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
||||
{{/vars}}
|
||||
|
@ -17,9 +17,9 @@ import com.google.gson.annotations.SerializedName;
|
||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||
{{#vars}}{{#isEnum}}
|
||||
|
||||
{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
|
||||
{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}}
|
||||
{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}}
|
||||
@SerializedName("{{baseName}}")
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
||||
{{/vars}}
|
||||
|
@ -6,11 +6,7 @@ import java.util.Objects;
|
||||
|
||||
{{#serializableModel}}import java.io.Serializable;{{/serializableModel}}
|
||||
{{#models}}
|
||||
{{#model}}{{#description}}
|
||||
/**
|
||||
* {{description}}
|
||||
**/{{/description}}
|
||||
{{#isEnum}}{{>enumOuterClass}}{{/isEnum}}
|
||||
{{^isEnum}}{{>pojo}}{{/isEnum}}
|
||||
{{#model}}
|
||||
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
|
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
private {{dataType}} value;
|
||||
|
||||
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{dataType}} value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
private {{datatype}} value;
|
||||
|
||||
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
@ -1,11 +1,14 @@
|
||||
{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}
|
||||
/**
|
||||
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||
*/{{#description}}
|
||||
@ApiModel(description = "{{{description}}}"){{/description}}
|
||||
{{>generatedAnnotation}}
|
||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||
{{#vars}}{{#isEnum}}
|
||||
|
||||
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
{{>modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
|
||||
{{>enumClass}}{{/items}}{{/items.isEnum}}
|
||||
{{>modelInnerEnum}}{{/items}}{{/items.isEnum}}
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
|
||||
|
||||
{{#vars}}{{^isReadOnly}}
|
||||
|
@ -1,17 +1,24 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
|
||||
public enum {{{datatypeWithEnum}}} {
|
||||
{{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
{{/-last}}{{#-last}};
|
||||
{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
private {{datatype}} value;
|
||||
|
||||
private String value;
|
||||
|
||||
{{{datatypeWithEnum}}}(String value) {
|
||||
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,24 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
|
||||
public enum {{{datatypeWithEnum}}} {
|
||||
{{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
{{/-last}}{{#-last}};
|
||||
{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
private {{datatype}} value;
|
||||
|
||||
private String value;
|
||||
|
||||
{{{datatypeWithEnum}}}(String value) {
|
||||
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,17 @@
|
||||
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
|
||||
* @readonly
|
||||
*/{{/emitJSDoc}}
|
||||
exports.{{datatypeWithEnum}} = { {{#allowableValues}}{{#enumVars}}
|
||||
{{#emitJSDoc}} /**
|
||||
* value: {{value}}
|
||||
exports.{{datatypeWithEnum}} = {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{#emitJSDoc}}
|
||||
/**
|
||||
* value: {{{value}}}
|
||||
* @const
|
||||
*/
|
||||
{{/emitJSDoc}} {{name}}: "{{value}}"{{^-last}},
|
||||
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
{{/emitJSDoc}}
|
||||
"{{name}}": {{{value}}}{{^-last}},
|
||||
{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
};
|
@ -15,91 +15,6 @@
|
||||
}(this, function(ApiClient{{#imports}}, {{import}}{{/imports}}) {
|
||||
'use strict';
|
||||
|
||||
{{#models}}{{#model}}{{#emitJSDoc}} /**
|
||||
* The {{classname}} model module.
|
||||
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||
* @version {{projectVersion}}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>{{classname}}</code>.{{#description}}
|
||||
* {{description}}{{/description}}
|
||||
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||
* @class{{#useInheritance}}{{#parent}}
|
||||
* @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}}
|
||||
* @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}}
|
||||
* @param {{.}}{{/vendorExtensions.x-all-required}}
|
||||
*/
|
||||
{{/emitJSDoc}} var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) {
|
||||
var _this = this;
|
||||
{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array();
|
||||
Object.setPrototypeOf(_this, exports);
|
||||
{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}}
|
||||
{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});
|
||||
{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}}
|
||||
{{/vars}}{{#parent}}{{^parentModel}} return _this;
|
||||
{{/parentModel}}{{/parent}} };
|
||||
|
||||
{{#emitJSDoc}} /**
|
||||
* Constructs a <code>{{classname}}</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> obj Optional instance to populate.
|
||||
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The populated <code>{{classname}}</code> instance.
|
||||
*/
|
||||
{{/emitJSDoc}} exports.constructFromObject = function(data, obj) {
|
||||
if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} {
|
||||
obj = obj || new exports();
|
||||
{{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, {{vendorExtensions.x-itemType}});
|
||||
{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.constructFromObject(data, obj);{{/parentModel}}
|
||||
{{#interfaces}} {{.}}.constructFromObject(data, obj);
|
||||
{{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) {
|
||||
obj['{{baseName}}']{{{defaultValueWithParam}}}
|
||||
}
|
||||
{{/vars}} }
|
||||
return obj;
|
||||
}
|
||||
{{#useInheritance}}{{#parentModel}}
|
||||
exports.prototype = Object.create({{classname}}.prototype);
|
||||
exports.prototype.constructor = exports;
|
||||
{{/parentModel}}{{/useInheritance}}
|
||||
{{#vars}}{{#emitJSDoc}}
|
||||
/**{{#description}}
|
||||
* {{{description}}}{{/description}}
|
||||
* @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}}
|
||||
* @default {{{defaultValue}}}{{/defaultValue}}
|
||||
*/
|
||||
{{/emitJSDoc}} exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
|
||||
{{/vars}}{{#useInheritance}}{{#interfaceModels}}
|
||||
// Implement {{classname}} interface:{{#allVars}}{{#emitJSDoc}}
|
||||
/**{{#description}}
|
||||
* {{{description}}}{{/description}}
|
||||
* @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}}
|
||||
* @default {{{defaultValue}}}{{/defaultValue}}
|
||||
*/
|
||||
{{/emitJSDoc}} exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
|
||||
{{/allVars}}{{/interfaceModels}}{{/useInheritance}}
|
||||
{{#emitModelMethods}}{{#vars}}{{#emitJSDoc}} /**{{#description}}
|
||||
* Returns {{{description}}}{{/description}}{{#minimum}}
|
||||
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
||||
* maximum: {{maximum}}{{/maximum}}
|
||||
* @return {{{vendorExtensions.x-jsdoc-type}}}
|
||||
*/
|
||||
{{/emitJSDoc}} exports.prototype.{{getter}} = function() {
|
||||
return this['{{baseName}}'];
|
||||
}
|
||||
|
||||
{{#emitJSDoc}} /**{{#description}}
|
||||
* Sets {{{description}}}{{/description}}
|
||||
* @param {{{vendorExtensions.x-jsdoc-type}}} {{name}}{{#description}} {{{description}}}{{/description}}
|
||||
*/
|
||||
{{/emitJSDoc}} exports.prototype.{{setter}} = function({{name}}) {
|
||||
this['{{baseName}}'] = {{name}};
|
||||
}
|
||||
|
||||
{{/vars}}{{/emitModelMethods}}
|
||||
{{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
{{>enumClass}}{{/items}}*/{{/items.isEnum}}{{/vars}}
|
||||
|
||||
return exports;
|
||||
{{/model}}{{/models}}}));
|
||||
{{#models}}{{#model}}
|
||||
{{#isEnum}}{{>partial_model_enum_class}}{{/isEnum}}{{^isEnum}}{{>partial_model_generic}}{{/isEnum}}
|
||||
{{/model}}{{/models}}
|
||||
|
@ -0,0 +1,24 @@
|
||||
{{#emitJSDoc}}
|
||||
/**
|
||||
* Enum class {{classname}}.
|
||||
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
|
||||
* @readonly
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
exports.{{classname}} = {
|
||||
{{#allowableValues}}
|
||||
{{#values}}
|
||||
{{#emitJSDoc}}
|
||||
/**
|
||||
* value: {{{.}}}
|
||||
* @const
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
"{{{.}}}": "{{{.}}}"{{^-last}},
|
||||
{{/-last}}
|
||||
{{/values}}
|
||||
{{/allowableValues}}
|
||||
};
|
||||
|
||||
return exports;
|
||||
}));
|
@ -0,0 +1,103 @@
|
||||
|
||||
{{#models}}{{#model}}
|
||||
{{#emitJSDoc}}
|
||||
/**
|
||||
* The {{classname}} model module.
|
||||
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||
* @version {{projectVersion}}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs a new <code>{{classname}}</code>.{{#description}}
|
||||
* {{description}}{{/description}}
|
||||
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||
* @class{{#useInheritance}}{{#parent}}
|
||||
* @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}}
|
||||
* @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}}
|
||||
* @param {{.}}{{/vendorExtensions.x-all-required}}
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) {
|
||||
var _this = this;
|
||||
{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array();
|
||||
Object.setPrototypeOf(_this, exports);
|
||||
{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}}
|
||||
{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});
|
||||
{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}}
|
||||
{{/vars}}{{#parent}}{{^parentModel}} return _this;
|
||||
{{/parentModel}}{{/parent}} };
|
||||
|
||||
{{#emitJSDoc}}
|
||||
/**
|
||||
* Constructs a <code>{{classname}}</code> from a plain JavaScript object, optionally creating a new instance.
|
||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||
* @param {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> obj Optional instance to populate.
|
||||
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The populated <code>{{classname}}</code> instance.
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
exports.constructFromObject = function(data, obj) {
|
||||
if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} {
|
||||
obj = obj || new exports();
|
||||
{{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, {{vendorExtensions.x-itemType}});
|
||||
{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.constructFromObject(data, obj);{{/parentModel}}
|
||||
{{#interfaces}} {{.}}.constructFromObject(data, obj);
|
||||
{{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) {
|
||||
obj['{{baseName}}']{{{defaultValueWithParam}}}
|
||||
}
|
||||
{{/vars}} }
|
||||
return obj;
|
||||
}
|
||||
{{#useInheritance}}{{#parentModel}}
|
||||
exports.prototype = Object.create({{classname}}.prototype);
|
||||
exports.prototype.constructor = exports;
|
||||
{{/parentModel}}{{/useInheritance}}
|
||||
{{#vars}}
|
||||
{{#emitJSDoc}}
|
||||
/**{{#description}}
|
||||
* {{{description}}}{{/description}}
|
||||
* @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}}
|
||||
* @default {{{defaultValue}}}{{/defaultValue}}
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
|
||||
{{/vars}}{{#useInheritance}}{{#interfaceModels}}
|
||||
// Implement {{classname}} interface:{{#allVars}}
|
||||
{{#emitJSDoc}}
|
||||
/**{{#description}}
|
||||
* {{{description}}}{{/description}}
|
||||
* @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}}
|
||||
* @default {{{defaultValue}}}{{/defaultValue}}
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
|
||||
{{/allVars}}{{/interfaceModels}}{{/useInheritance}}
|
||||
{{#emitModelMethods}}{{#vars}}
|
||||
{{#emitJSDoc}}
|
||||
/**{{#description}}
|
||||
* Returns {{{description}}}{{/description}}{{#minimum}}
|
||||
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
||||
* maximum: {{maximum}}{{/maximum}}
|
||||
* @return {{{vendorExtensions.x-jsdoc-type}}}
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
exports.prototype.{{getter}} = function() {
|
||||
return this['{{baseName}}'];
|
||||
}
|
||||
|
||||
{{#emitJSDoc}}
|
||||
/**{{#description}}
|
||||
* Sets {{{description}}}{{/description}}
|
||||
* @param {{{vendorExtensions.x-jsdoc-type}}} {{name}}{{#description}} {{{description}}}{{/description}}
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
exports.prototype.{{setter}} = function({{name}}) {
|
||||
this['{{baseName}}'] = {{name}};
|
||||
}
|
||||
|
||||
{{/vars}}{{/emitModelMethods}}
|
||||
{{#vars}}{{#isEnum}}{{>partial_model_inner_enum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
{{>partial_model_inner_enum}}{{/items}}*/{{/items.isEnum}}{{/vars}}
|
||||
|
||||
return exports;
|
||||
{{/model}}{{/models}}}));
|
@ -0,0 +1,21 @@
|
||||
{{#emitJSDoc}}
|
||||
/**
|
||||
* Allowed values for the <code>{{baseName}}</code> property.
|
||||
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
|
||||
* @readonly
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
exports.{{datatypeWithEnum}} = {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{#emitJSDoc}}
|
||||
/**
|
||||
* value: {{{value}}}
|
||||
* @const
|
||||
*/
|
||||
{{/emitJSDoc}}
|
||||
"{{name}}": {{{value}}}{{^-last}},
|
||||
{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
};
|
@ -1,6 +1,15 @@
|
||||
public enum {{vendorExtensions.plainDatatypeWithEnum}} {
|
||||
/// <summary>
|
||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{{description}}}</value>{{/description}}
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
|
||||
{
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
[EnumMember(Value = "{{jsonname}}")]
|
||||
{{name}}{{^-last}},
|
||||
{{/-last}}{{#-last}}{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
/// <summary>
|
||||
/// Enum {{name}} for {{{value}}}
|
||||
/// </summary>
|
||||
[EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})]
|
||||
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}},
|
||||
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
}
|
||||
|
@ -13,145 +13,7 @@ using Newtonsoft.Json.Converters;
|
||||
{{#model}}
|
||||
namespace {{packageName}}.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// {{description}}
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}>
|
||||
{ {{#vars}}{{#isEnum}}
|
||||
|
||||
/// <summary>
|
||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{{description}}}</value>{{/description}}
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
{{>enumClass}}{{/items}}{{/items.isEnum}}{{/vars}}
|
||||
{{#vars}}{{#isEnum}}
|
||||
/// <summary>
|
||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{{description}}}</value>{{/description}}
|
||||
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]
|
||||
public {{{datatypeWithEnum}}} {{name}} { get; set; }
|
||||
{{/isEnum}}{{/vars}}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
|
||||
/// Initializes a new instance of the <see cref="{{classname}}" />class.
|
||||
/// </summary>
|
||||
{{#vars}}{{^isReadOnly}} /// <param name="{{name}}">{{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}.</param>
|
||||
{{/isReadOnly}}{{/vars}}
|
||||
public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}} {{name}} = null{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}})
|
||||
{
|
||||
{{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null)
|
||||
if ({{name}} == null)
|
||||
{
|
||||
throw new InvalidDataException("{{name}} is a required property for {{classname}} and cannot be null");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.{{name}} = {{name}};
|
||||
}
|
||||
{{/required}}{{/isReadOnly}}{{/vars}}{{#vars}}{{^isReadOnly}}{{^required}}{{#defaultValue}}// use default value if no "{{name}}" provided
|
||||
if ({{name}} == null)
|
||||
{
|
||||
this.{{name}} = {{{defaultValue}}};
|
||||
}
|
||||
else
|
||||
{
|
||||
this.{{name}} = {{name}};
|
||||
}
|
||||
{{/defaultValue}}{{^defaultValue}}this.{{name}} = {{name}};
|
||||
{{/defaultValue}}{{/required}}{{/isReadOnly}}{{/vars}}
|
||||
}
|
||||
|
||||
{{#vars}}{{^isEnum}}
|
||||
/// <summary>
|
||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{description}}</value>{{/description}}
|
||||
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]
|
||||
public {{{datatype}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
|
||||
{{/isEnum}}{{/vars}}
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class {{classname}} {\n");
|
||||
{{#vars}}
|
||||
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||
{{/vars}}
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public {{#parent}} new {{/parent}}string ToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/10454552/677735
|
||||
return this.Equals(obj as {{classname}});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if {{classname}} instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of {{classname}} to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals({{classname}} other)
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/10454552/677735
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
return {{#vars}}{{#isNotContainer}}
|
||||
(
|
||||
this.{{name}} == other.{{name}} ||
|
||||
this.{{name}} != null &&
|
||||
this.{{name}}.Equals(other.{{name}})
|
||||
){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{^isNotContainer}}
|
||||
(
|
||||
this.{{name}} == other.{{name}} ||
|
||||
this.{{name}} != null &&
|
||||
this.{{name}}.SequenceEqual(other.{{name}})
|
||||
){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{/vars}}{{^vars}}false{{/vars}};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/263416/677735
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
int hash = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
{{#vars}}
|
||||
if (this.{{name}} != null)
|
||||
hash = hash * 59 + this.{{name}}.GetHashCode();
|
||||
{{/vars}}
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
/// <summary>
|
||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{{description}}}</value>{{/description}}
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
|
||||
{
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
/// <summary>
|
||||
/// Enum {{name}} for {{{value}}}
|
||||
/// </summary>
|
||||
[EnumMember(Value = {{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}})]
|
||||
{{name}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}},
|
||||
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
/// <summary>
|
||||
/// {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}>
|
||||
{
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
{{>modelInnerEnum}}
|
||||
{{/isEnum}}
|
||||
{{#items.isEnum}}
|
||||
{{#items}}
|
||||
{{>modelInnerEnum}}
|
||||
{{/items}}
|
||||
{{/items.isEnum}}
|
||||
{{/vars}}
|
||||
{{#vars}}
|
||||
{{#isEnum}}
|
||||
/// <summary>
|
||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{{description}}}</value>{{/description}}
|
||||
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]
|
||||
public {{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} { get; set; }
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
|
||||
/// </summary>
|
||||
{{#vars}}
|
||||
{{^isReadOnly}}
|
||||
/// <param name="{{name}}">{{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}.</param>
|
||||
{{/isReadOnly}}
|
||||
{{/vars}}
|
||||
public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{#hasMore}}, {{/hasMore}}{{/isReadOnly}}{{/vars}})
|
||||
{
|
||||
{{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null)
|
||||
if ({{name}} == null)
|
||||
{
|
||||
throw new InvalidDataException("{{name}} is a required property for {{classname}} and cannot be null");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.{{name}} = {{name}};
|
||||
}
|
||||
{{/required}}{{/isReadOnly}}{{/vars}}
|
||||
{{#vars}}{{^isReadOnly}}{{^required}}
|
||||
{{#defaultValue}}// use default value if no "{{name}}" provided
|
||||
if ({{name}} == null)
|
||||
{
|
||||
this.{{name}} = {{{defaultValue}}};
|
||||
}
|
||||
else
|
||||
{
|
||||
this.{{name}} = {{name}};
|
||||
}
|
||||
{{/defaultValue}}
|
||||
{{^defaultValue}}
|
||||
this.{{name}} = {{name}};
|
||||
{{/defaultValue}}
|
||||
{{/required}}{{/isReadOnly}}{{/vars}}
|
||||
}
|
||||
|
||||
{{#vars}}
|
||||
{{^isEnum}}
|
||||
/// <summary>
|
||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{description}}</value>{{/description}}
|
||||
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]
|
||||
public {{{datatype}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class {{classname}} {\n");
|
||||
{{#vars}}sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||
{{/vars}}
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public {{#parent}} new {{/parent}}string ToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/10454552/677735
|
||||
return this.Equals(obj as {{classname}});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if {{classname}} instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of {{classname}} to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals({{classname}} other)
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/10454552/677735
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
return {{#vars}}{{#isNotContainer}}
|
||||
(
|
||||
this.{{name}} == other.{{name}} ||
|
||||
this.{{name}} != null &&
|
||||
this.{{name}}.Equals(other.{{name}})
|
||||
){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{^isNotContainer}}
|
||||
(
|
||||
this.{{name}} == other.{{name}} ||
|
||||
this.{{name}} != null &&
|
||||
this.{{name}}.SequenceEqual(other.{{name}})
|
||||
){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{/vars}}{{^vars}}false{{/vars}};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/263416/677735
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
int hash = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
{{#vars}}
|
||||
if (this.{{name}} != null)
|
||||
hash = hash * 59 + this.{{name}}.GetHashCode();
|
||||
{{/vars}}
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
/// <summary>
|
||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
/// </summary>{{#description}}
|
||||
/// <value>{{{description}}}</value>{{/description}}
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
|
||||
{
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
/// <summary>
|
||||
/// Enum {{name}} for {{{value}}}
|
||||
/// </summary>
|
||||
[EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})]
|
||||
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}},
|
||||
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
}
|
@ -69,7 +69,7 @@ class ApiClient
|
||||
* Constructor of the class
|
||||
* @param Configuration $config config for this ApiClient
|
||||
*/
|
||||
public function __construct(Configuration $config = null)
|
||||
public function __construct(\{{invokerPackage}}\Configuration $config = null)
|
||||
{
|
||||
if ($config == null) {
|
||||
$config = Configuration::getDefaultConfiguration();
|
||||
|
@ -60,7 +60,7 @@ use \{{invokerPackage}}\ObjectSerializer;
|
||||
* Constructor
|
||||
* @param \{{invokerPackage}}\ApiClient|null $apiClient The api client to use
|
||||
*/
|
||||
function __construct($apiClient = null)
|
||||
function __construct(\{{invokerPackage}}\ApiClient $apiClient = null)
|
||||
{
|
||||
if ($apiClient == null) {
|
||||
$apiClient = new ApiClient();
|
||||
@ -84,7 +84,7 @@ use \{{invokerPackage}}\ObjectSerializer;
|
||||
* @param \{{invokerPackage}}\ApiClient $apiClient set the API client
|
||||
* @return {{classname}}
|
||||
*/
|
||||
public function setApiClient(ApiClient $apiClient)
|
||||
public function setApiClient(\{{invokerPackage}}\ApiClient $apiClient)
|
||||
{
|
||||
$this->apiClient = $apiClient;
|
||||
return $this;
|
||||
|
@ -68,9 +68,9 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name, and the value is the original name
|
||||
* @var string[]
|
||||
*/
|
||||
* Array of attributes where the key is the local name, and the value is the original name
|
||||
* @var string[]
|
||||
*/
|
||||
static $attributeMap = array(
|
||||
{{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
@ -81,9 +81,9 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
* @var string[]
|
||||
*/
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
* @var string[]
|
||||
*/
|
||||
static $setters = array(
|
||||
{{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
@ -94,9 +94,9 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
* @var string[]
|
||||
*/
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
* @var string[]
|
||||
*/
|
||||
static $getters = array(
|
||||
{{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
@ -106,11 +106,27 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
return {{#parent}}parent::getters() + {{/parent}}self::$getters;
|
||||
}
|
||||
|
||||
{{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}const {{datatypeWithEnum}}_{{{name}}} = {{{value}}};
|
||||
{{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}}
|
||||
|
||||
{{#vars}}{{#isEnum}}
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public function {{getter}}AllowableValues() {
|
||||
return [
|
||||
{{#allowableValues}}{{#enumVars}}self::{{datatypeWithEnum}}_{{{name}}},{{^-last}}
|
||||
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
];
|
||||
}
|
||||
{{/isEnum}}{{/vars}}
|
||||
|
||||
{{#vars}}
|
||||
/**
|
||||
* ${{name}} {{#description}}{{{description}}}{{/description}}
|
||||
* @var {{datatype}}
|
||||
*/
|
||||
* ${{name}} {{#description}}{{{description}}}{{/description}}
|
||||
* @var {{datatype}}
|
||||
*/
|
||||
protected ${{name}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}};
|
||||
{{/vars}}
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
class {{classname}} {
|
||||
{{#allowableValues}}{{#enumVars}}const {{{name}}} = {{{value}}};
|
||||
{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
{{#vars}}{{#isEnum}}
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public function {{getter}}AllowableValues() {
|
||||
return [
|
||||
{{#allowableValues}}{{#enumVars}}self::{{datatypeWithEnum}}_{{{name}}},{{^-last}}
|
||||
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
];
|
||||
}
|
||||
{{/isEnum}}{{/vars}}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayAccess
|
||||
{
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
* @var string[]
|
||||
*/
|
||||
static $swaggerTypes = array(
|
||||
{{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
);
|
||||
|
||||
static function swaggerTypes() {
|
||||
return self::$swaggerTypes{{#parent}} + parent::swaggerTypes(){{/parent}};
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name, and the value is the original name
|
||||
* @var string[]
|
||||
*/
|
||||
static $attributeMap = array(
|
||||
{{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
);
|
||||
|
||||
static function attributeMap() {
|
||||
return {{#parent}}parent::attributeMap() + {{/parent}}self::$attributeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
* @var string[]
|
||||
*/
|
||||
static $setters = array(
|
||||
{{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
);
|
||||
|
||||
static function setters() {
|
||||
return {{#parent}}parent::setters() + {{/parent}}self::$setters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
* @var string[]
|
||||
*/
|
||||
static $getters = array(
|
||||
{{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
);
|
||||
|
||||
static function getters() {
|
||||
return {{#parent}}parent::getters() + {{/parent}}self::$getters;
|
||||
}
|
||||
|
||||
{{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}const {{datatypeWithEnum}}_{{{name}}} = {{{value}}};
|
||||
{{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}}
|
||||
|
||||
{{#vars}}{{#isEnum}}
|
||||
/**
|
||||
* Gets allowable values of the enum
|
||||
* @return string[]
|
||||
*/
|
||||
public function {{getter}}AllowableValues() {
|
||||
return [
|
||||
{{#allowableValues}}{{#enumVars}}self::{{datatypeWithEnum}}_{{{name}}},{{^-last}}
|
||||
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
];
|
||||
}
|
||||
{{/isEnum}}{{/vars}}
|
||||
|
||||
{{#vars}}
|
||||
/**
|
||||
* ${{name}} {{#description}}{{{description}}}{{/description}}
|
||||
* @var {{datatype}}
|
||||
*/
|
||||
protected ${{name}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}};
|
||||
{{/vars}}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
{{#parent}}parent::__construct($data);{{/parent}}
|
||||
if ($data != null) {
|
||||
{{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}}
|
||||
{{/hasMore}}{{/vars}}
|
||||
}
|
||||
}
|
||||
{{#vars}}
|
||||
/**
|
||||
* Gets {{name}}.
|
||||
* @return {{datatype}}
|
||||
*/
|
||||
public function {{getter}}()
|
||||
{
|
||||
return $this->{{name}};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets {{name}}.
|
||||
* @param {{datatype}} ${{name}} {{#description}}{{{description}}}{{/description}}
|
||||
* @return $this
|
||||
*/
|
||||
public function {{setter}}(${{name}})
|
||||
{
|
||||
{{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}});
|
||||
if (!in_array(${{{name}}}, $allowed_values)) {
|
||||
throw new \InvalidArgumentException("Invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}");
|
||||
}{{/isEnum}}
|
||||
$this->{{name}} = ${{name}};
|
||||
return $this;
|
||||
}
|
||||
{{/vars}}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
* @param integer $offset Offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
* @param integer $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
* @param integer $offset Offset
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string presentation of the object.
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
@ -899,6 +899,33 @@ definitions:
|
||||
format: password
|
||||
maxLength: 64
|
||||
minLength: 10
|
||||
EnumClass:
|
||||
type: string
|
||||
default: '-efg'
|
||||
enum:
|
||||
- _abc
|
||||
- '-efg'
|
||||
- (xyz)
|
||||
Enum_Test:
|
||||
type: object
|
||||
properties:
|
||||
enum_string:
|
||||
type: string
|
||||
enum:
|
||||
- UPPER
|
||||
- lower
|
||||
enum_integer:
|
||||
type: integer
|
||||
format: int32
|
||||
enum:
|
||||
- 1
|
||||
- -1
|
||||
enum_number:
|
||||
type: number
|
||||
format: double
|
||||
enum:
|
||||
- 1.1
|
||||
- -1.2
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: 'http://swagger.io'
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
|
@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c
|
||||
|
||||
- API version: 1.0.0
|
||||
- SDK version: 1.0.0
|
||||
- Build date: 2016-05-02T22:02:29.555+08:00
|
||||
- Build date: 2016-04-27T22:04:12.906+08:00
|
||||
- Build package: class io.swagger.codegen.languages.CSharpClientCodegen
|
||||
|
||||
## Frameworks supported
|
||||
@ -54,7 +54,7 @@ namespace Example
|
||||
{
|
||||
|
||||
var apiInstance = new FakeApi();
|
||||
var number = 3.4; // double? | None
|
||||
var number = number_example; // string | None
|
||||
var _double = 1.2; // double? | None
|
||||
var _string = _string_example; // string | None
|
||||
var _byte = B; // byte[] | None
|
||||
@ -117,6 +117,8 @@ Class | Method | HTTP request | Description
|
||||
- [IO.Swagger.Model.Cat](docs/Cat.md)
|
||||
- [IO.Swagger.Model.Category](docs/Category.md)
|
||||
- [IO.Swagger.Model.Dog](docs/Dog.md)
|
||||
- [IO.Swagger.Model.EnumClass](docs/EnumClass.md)
|
||||
- [IO.Swagger.Model.EnumTest](docs/EnumTest.md)
|
||||
- [IO.Swagger.Model.FormatTest](docs/FormatTest.md)
|
||||
- [IO.Swagger.Model.Model200Response](docs/Model200Response.md)
|
||||
- [IO.Swagger.Model.ModelReturn](docs/ModelReturn.md)
|
||||
|
@ -14,7 +14,6 @@ Name | Type | Description | Notes
|
||||
**Binary** | **byte[]** | | [optional]
|
||||
**Date** | **DateTime?** | |
|
||||
**DateTime** | **DateTime?** | | [optional]
|
||||
**Uuid** | **Guid?** | | [optional]
|
||||
**Password** | **string** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
@ -12,18 +12,15 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Animal
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Animal : IEquatable<Animal>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Animal" /> class.
|
||||
/// Initializes a new instance of the <see cref="Animal" />class.
|
||||
/// </summary>
|
||||
/// <param name="ClassName">ClassName (required).</param>
|
||||
|
||||
public Animal(string ClassName = null)
|
||||
{
|
||||
// to ensure "ClassName" is required (not null)
|
||||
@ -36,15 +33,14 @@ namespace IO.Swagger.Model
|
||||
this.ClassName = ClassName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[DataMember(Name="className", EmitDefaultValue=false)]
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -113,6 +109,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,47 +12,44 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// ApiResponse
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class ApiResponse : IEquatable<ApiResponse>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiResponse" /> class.
|
||||
/// Initializes a new instance of the <see cref="ApiResponse" />class.
|
||||
/// </summary>
|
||||
/// <param name="Code">Code.</param>
|
||||
/// <param name="Type">Type.</param>
|
||||
/// <param name="Message">Message.</param>
|
||||
|
||||
public ApiResponse(int? Code = null, string Type = null, string Message = null)
|
||||
{
|
||||
this.Code = Code;
|
||||
this.Type = Type;
|
||||
this.Message = Message;
|
||||
|
||||
|
||||
this.Code = Code;
|
||||
|
||||
this.Type = Type;
|
||||
|
||||
this.Message = Message;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Code
|
||||
/// </summary>
|
||||
[DataMember(Name="code", EmitDefaultValue=false)]
|
||||
public int? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Type
|
||||
/// </summary>
|
||||
[DataMember(Name="type", EmitDefaultValue=false)]
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Message
|
||||
/// </summary>
|
||||
[DataMember(Name="message", EmitDefaultValue=false)]
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -62,8 +59,8 @@ namespace IO.Swagger.Model
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class ApiResponse {\n");
|
||||
sb.Append(" Code: ").Append(Code).Append("\n");
|
||||
sb.Append(" Type: ").Append(Type).Append("\n");
|
||||
sb.Append(" Message: ").Append(Message).Append("\n");
|
||||
sb.Append(" Type: ").Append(Type).Append("\n");
|
||||
sb.Append(" Message: ").Append(Message).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -137,6 +134,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,19 +12,16 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Cat
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Cat : Animal, IEquatable<Cat>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Cat" /> class.
|
||||
/// Initializes a new instance of the <see cref="Cat" />class.
|
||||
/// </summary>
|
||||
/// <param name="ClassName">ClassName (required).</param>
|
||||
/// <param name="Declawed">Declawed.</param>
|
||||
|
||||
public Cat(string ClassName = null, bool? Declawed = null)
|
||||
{
|
||||
// to ensure "ClassName" is required (not null)
|
||||
@ -36,23 +33,22 @@ namespace IO.Swagger.Model
|
||||
{
|
||||
this.ClassName = ClassName;
|
||||
}
|
||||
this.Declawed = Declawed;
|
||||
|
||||
|
||||
this.Declawed = Declawed;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[DataMember(Name="className", EmitDefaultValue=false)]
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Declawed
|
||||
/// </summary>
|
||||
[DataMember(Name="declawed", EmitDefaultValue=false)]
|
||||
public bool? Declawed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -62,7 +58,7 @@ namespace IO.Swagger.Model
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Cat {\n");
|
||||
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
|
||||
sb.Append(" Declawed: ").Append(Declawed).Append("\n");
|
||||
sb.Append(" Declawed: ").Append(Declawed).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -129,6 +125,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,39 +12,36 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Category
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Category : IEquatable<Category>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Category" /> class.
|
||||
/// Initializes a new instance of the <see cref="Category" />class.
|
||||
/// </summary>
|
||||
/// <param name="Id">Id.</param>
|
||||
/// <param name="Name">Name.</param>
|
||||
|
||||
public Category(long? Id = null, string Name = null)
|
||||
{
|
||||
this.Id = Id;
|
||||
this.Name = Name;
|
||||
|
||||
|
||||
this.Id = Id;
|
||||
|
||||
this.Name = Name;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -54,7 +51,7 @@ namespace IO.Swagger.Model
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Category {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -121,6 +118,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,19 +12,16 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Dog
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Dog : Animal, IEquatable<Dog>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Dog" /> class.
|
||||
/// Initializes a new instance of the <see cref="Dog" />class.
|
||||
/// </summary>
|
||||
/// <param name="ClassName">ClassName (required).</param>
|
||||
/// <param name="Breed">Breed.</param>
|
||||
|
||||
public Dog(string ClassName = null, string Breed = null)
|
||||
{
|
||||
// to ensure "ClassName" is required (not null)
|
||||
@ -36,23 +33,22 @@ namespace IO.Swagger.Model
|
||||
{
|
||||
this.ClassName = ClassName;
|
||||
}
|
||||
this.Breed = Breed;
|
||||
|
||||
|
||||
this.Breed = Breed;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ClassName
|
||||
/// </summary>
|
||||
[DataMember(Name="className", EmitDefaultValue=false)]
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Breed
|
||||
/// </summary>
|
||||
[DataMember(Name="breed", EmitDefaultValue=false)]
|
||||
public string Breed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -62,7 +58,7 @@ namespace IO.Swagger.Model
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Dog {\n");
|
||||
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
|
||||
sb.Append(" Breed: ").Append(Breed).Append("\n");
|
||||
sb.Append(" Breed: ").Append(Breed).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -129,6 +125,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets EnumClass
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum EnumClass
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum Abc for "_abc"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "_abc")]
|
||||
Abc,
|
||||
|
||||
/// <summary>
|
||||
/// Enum efg for "-efg"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "-efg")]
|
||||
efg,
|
||||
|
||||
/// <summary>
|
||||
/// Enum xyz for "(xyz)"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "(xyz)")]
|
||||
xyz
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,199 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// EnumTest
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class EnumTest : IEquatable<EnumTest>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets EnumString
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum EnumStringEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum Upper for "UPPER"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "UPPER")]
|
||||
Upper,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Lower for "lower"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "lower")]
|
||||
Lower
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets EnumInteger
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum EnumIntegerEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum NUMBER_1 for 1
|
||||
/// </summary>
|
||||
[EnumMember(Value = "1")]
|
||||
NUMBER_1 = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Enum NUMBER_MINUS_1 for -1
|
||||
/// </summary>
|
||||
[EnumMember(Value = "-1")]
|
||||
NUMBER_MINUS_1 = -1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets EnumNumber
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum EnumNumberEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum NUMBER_1_DOT_1 for 1.1
|
||||
/// </summary>
|
||||
[EnumMember(Value = "1.1")]
|
||||
NUMBER_1_DOT_1,
|
||||
|
||||
/// <summary>
|
||||
/// Enum NUMBER_MINUS_1_DOT_2 for -1.2
|
||||
/// </summary>
|
||||
[EnumMember(Value = "-1.2")]
|
||||
NUMBER_MINUS_1_DOT_2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets EnumString
|
||||
/// </summary>
|
||||
[DataMember(Name="enum_string", EmitDefaultValue=false)]
|
||||
public EnumStringEnum? EnumString { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets EnumInteger
|
||||
/// </summary>
|
||||
[DataMember(Name="enum_integer", EmitDefaultValue=false)]
|
||||
public EnumIntegerEnum? EnumInteger { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or Sets EnumNumber
|
||||
/// </summary>
|
||||
[DataMember(Name="enum_number", EmitDefaultValue=false)]
|
||||
public EnumNumberEnum? EnumNumber { get; set; }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EnumTest" /> class.
|
||||
/// </summary>
|
||||
/// <param name="EnumString">EnumString.</param>
|
||||
/// <param name="EnumInteger">EnumInteger.</param>
|
||||
/// <param name="EnumNumber">EnumNumber.</param>
|
||||
public EnumTest(EnumStringEnum? EnumString = null, EnumIntegerEnum? EnumInteger = null, EnumNumberEnum? EnumNumber = null)
|
||||
{
|
||||
|
||||
|
||||
this.EnumString = EnumString;
|
||||
|
||||
this.EnumInteger = EnumInteger;
|
||||
|
||||
this.EnumNumber = EnumNumber;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class EnumTest {\n");
|
||||
sb.Append(" EnumString: ").Append(EnumString).Append("\n");
|
||||
sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n");
|
||||
sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/10454552/677735
|
||||
return this.Equals(obj as EnumTest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if EnumTest instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of EnumTest to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(EnumTest other)
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/10454552/677735
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
return
|
||||
(
|
||||
this.EnumString == other.EnumString ||
|
||||
this.EnumString != null &&
|
||||
this.EnumString.Equals(other.EnumString)
|
||||
) &&
|
||||
(
|
||||
this.EnumInteger == other.EnumInteger ||
|
||||
this.EnumInteger != null &&
|
||||
this.EnumInteger.Equals(other.EnumInteger)
|
||||
) &&
|
||||
(
|
||||
this.EnumNumber == other.EnumNumber ||
|
||||
this.EnumNumber != null &&
|
||||
this.EnumNumber.Equals(other.EnumNumber)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/263416/677735
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
int hash = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
if (this.EnumString != null)
|
||||
hash = hash * 59 + this.EnumString.GetHashCode();
|
||||
if (this.EnumInteger != null)
|
||||
hash = hash * 59 + this.EnumInteger.GetHashCode();
|
||||
if (this.EnumNumber != null)
|
||||
hash = hash * 59 + this.EnumNumber.GetHashCode();
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -12,15 +12,13 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// FormatTest
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class FormatTest : IEquatable<FormatTest>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FormatTest" /> class.
|
||||
/// Initializes a new instance of the <see cref="FormatTest" />class.
|
||||
/// </summary>
|
||||
/// <param name="Integer">Integer.</param>
|
||||
/// <param name="Int32">Int32.</param>
|
||||
@ -33,10 +31,8 @@ namespace IO.Swagger.Model
|
||||
/// <param name="Binary">Binary.</param>
|
||||
/// <param name="Date">Date (required).</param>
|
||||
/// <param name="DateTime">DateTime.</param>
|
||||
/// <param name="Uuid">Uuid.</param>
|
||||
/// <param name="Password">Password (required).</param>
|
||||
|
||||
public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, Guid? Uuid = null, string Password = null)
|
||||
public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, DateTime? DateTime = null, string Password = null)
|
||||
{
|
||||
// to ensure "Number" is required (not null)
|
||||
if (Number == null)
|
||||
@ -74,97 +70,86 @@ namespace IO.Swagger.Model
|
||||
{
|
||||
this.Password = Password;
|
||||
}
|
||||
this.Integer = Integer;
|
||||
this.Int32 = Int32;
|
||||
this.Int64 = Int64;
|
||||
this._Float = _Float;
|
||||
this._Double = _Double;
|
||||
this._String = _String;
|
||||
this.Binary = Binary;
|
||||
this.DateTime = DateTime;
|
||||
this.Uuid = Uuid;
|
||||
|
||||
|
||||
this.Integer = Integer;
|
||||
|
||||
this.Int32 = Int32;
|
||||
|
||||
this.Int64 = Int64;
|
||||
|
||||
this._Float = _Float;
|
||||
|
||||
this._Double = _Double;
|
||||
|
||||
this._String = _String;
|
||||
|
||||
this.Binary = Binary;
|
||||
|
||||
this.DateTime = DateTime;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Integer
|
||||
/// </summary>
|
||||
[DataMember(Name="integer", EmitDefaultValue=false)]
|
||||
public int? Integer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Int32
|
||||
/// </summary>
|
||||
[DataMember(Name="int32", EmitDefaultValue=false)]
|
||||
public int? Int32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Int64
|
||||
/// </summary>
|
||||
[DataMember(Name="int64", EmitDefaultValue=false)]
|
||||
public long? Int64 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Number
|
||||
/// </summary>
|
||||
[DataMember(Name="number", EmitDefaultValue=false)]
|
||||
public double? Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets _Float
|
||||
/// </summary>
|
||||
[DataMember(Name="float", EmitDefaultValue=false)]
|
||||
public float? _Float { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets _Double
|
||||
/// </summary>
|
||||
[DataMember(Name="double", EmitDefaultValue=false)]
|
||||
public double? _Double { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets _String
|
||||
/// </summary>
|
||||
[DataMember(Name="string", EmitDefaultValue=false)]
|
||||
public string _String { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets _Byte
|
||||
/// </summary>
|
||||
[DataMember(Name="byte", EmitDefaultValue=false)]
|
||||
public byte[] _Byte { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Binary
|
||||
/// </summary>
|
||||
[DataMember(Name="binary", EmitDefaultValue=false)]
|
||||
public byte[] Binary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Date
|
||||
/// </summary>
|
||||
[DataMember(Name="date", EmitDefaultValue=false)]
|
||||
public DateTime? Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets DateTime
|
||||
/// </summary>
|
||||
[DataMember(Name="dateTime", EmitDefaultValue=false)]
|
||||
public DateTime? DateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Uuid
|
||||
/// </summary>
|
||||
[DataMember(Name="uuid", EmitDefaultValue=false)]
|
||||
public Guid? Uuid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Password
|
||||
/// </summary>
|
||||
[DataMember(Name="password", EmitDefaultValue=false)]
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -174,18 +159,17 @@ namespace IO.Swagger.Model
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class FormatTest {\n");
|
||||
sb.Append(" Integer: ").Append(Integer).Append("\n");
|
||||
sb.Append(" Int32: ").Append(Int32).Append("\n");
|
||||
sb.Append(" Int64: ").Append(Int64).Append("\n");
|
||||
sb.Append(" Number: ").Append(Number).Append("\n");
|
||||
sb.Append(" _Float: ").Append(_Float).Append("\n");
|
||||
sb.Append(" _Double: ").Append(_Double).Append("\n");
|
||||
sb.Append(" _String: ").Append(_String).Append("\n");
|
||||
sb.Append(" _Byte: ").Append(_Byte).Append("\n");
|
||||
sb.Append(" Binary: ").Append(Binary).Append("\n");
|
||||
sb.Append(" Date: ").Append(Date).Append("\n");
|
||||
sb.Append(" DateTime: ").Append(DateTime).Append("\n");
|
||||
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
|
||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||
sb.Append(" Int32: ").Append(Int32).Append("\n");
|
||||
sb.Append(" Int64: ").Append(Int64).Append("\n");
|
||||
sb.Append(" Number: ").Append(Number).Append("\n");
|
||||
sb.Append(" _Float: ").Append(_Float).Append("\n");
|
||||
sb.Append(" _Double: ").Append(_Double).Append("\n");
|
||||
sb.Append(" _String: ").Append(_String).Append("\n");
|
||||
sb.Append(" _Byte: ").Append(_Byte).Append("\n");
|
||||
sb.Append(" Binary: ").Append(Binary).Append("\n");
|
||||
sb.Append(" Date: ").Append(Date).Append("\n");
|
||||
sb.Append(" DateTime: ").Append(DateTime).Append("\n");
|
||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -277,11 +261,6 @@ namespace IO.Swagger.Model
|
||||
this.DateTime != null &&
|
||||
this.DateTime.Equals(other.DateTime)
|
||||
) &&
|
||||
(
|
||||
this.Uuid == other.Uuid ||
|
||||
this.Uuid != null &&
|
||||
this.Uuid.Equals(other.Uuid)
|
||||
) &&
|
||||
(
|
||||
this.Password == other.Password ||
|
||||
this.Password != null &&
|
||||
@ -322,13 +301,11 @@ namespace IO.Swagger.Model
|
||||
hash = hash * 59 + this.Date.GetHashCode();
|
||||
if (this.DateTime != null)
|
||||
hash = hash * 59 + this.DateTime.GetHashCode();
|
||||
if (this.Uuid != null)
|
||||
hash = hash * 59 + this.Uuid.GetHashCode();
|
||||
if (this.Password != null)
|
||||
hash = hash * 59 + this.Password.GetHashCode();
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
@ -12,25 +13,34 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// InlineResponse200
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class InlineResponse200 : IEquatable<InlineResponse200>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// pet status in the store
|
||||
/// </summary>
|
||||
/// <value>pet status in the store</value>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum StatusEnum {
|
||||
public enum StatusEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum Available for "available"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "available")]
|
||||
Available,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Pending for "pending"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "pending")]
|
||||
Pending,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Sold for "sold"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "sold")]
|
||||
Sold
|
||||
}
|
||||
@ -47,14 +57,14 @@ namespace IO.Swagger.Model
|
||||
/// Initializes a new instance of the <see cref="InlineResponse200" /> class.
|
||||
/// Initializes a new instance of the <see cref="InlineResponse200" />class.
|
||||
/// </summary>
|
||||
/// <param name="PhotoUrls">PhotoUrls.</param>
|
||||
/// <param name="Name">Name.</param>
|
||||
/// <param name="Tags">Tags.</param>
|
||||
/// <param name="Id">Id (required).</param>
|
||||
/// <param name="Category">Category.</param>
|
||||
/// <param name="Tags">Tags.</param>
|
||||
/// <param name="Status">pet status in the store.</param>
|
||||
/// <param name="Name">Name.</param>
|
||||
/// <param name="PhotoUrls">PhotoUrls.</param>
|
||||
|
||||
public InlineResponse200(List<string> PhotoUrls = null, string Name = null, long? Id = null, Object Category = null, List<Tag> Tags = null, StatusEnum? Status = null)
|
||||
public InlineResponse200(List<Tag> Tags = null, long? Id = null, Object Category = null, StatusEnum? Status = null, string Name = null, List<string> PhotoUrls = null)
|
||||
{
|
||||
// to ensure "Id" is required (not null)
|
||||
if (Id == null)
|
||||
@ -65,26 +75,20 @@ namespace IO.Swagger.Model
|
||||
{
|
||||
this.Id = Id;
|
||||
}
|
||||
this.PhotoUrls = PhotoUrls;
|
||||
this.Name = Name;
|
||||
this.Category = Category;
|
||||
this.Tags = Tags;
|
||||
this.Category = Category;
|
||||
this.Status = Status;
|
||||
this.Name = Name;
|
||||
this.PhotoUrls = PhotoUrls;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets PhotoUrls
|
||||
/// Gets or Sets Tags
|
||||
/// </summary>
|
||||
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
||||
public List<string> PhotoUrls { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
[DataMember(Name="tags", EmitDefaultValue=false)]
|
||||
public List<Tag> Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
@ -99,10 +103,16 @@ namespace IO.Swagger.Model
|
||||
public Object Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Tags
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[DataMember(Name="tags", EmitDefaultValue=false)]
|
||||
public List<Tag> Tags { get; set; }
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets PhotoUrls
|
||||
/// </summary>
|
||||
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
||||
public List<string> PhotoUrls { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
@ -112,12 +122,13 @@ namespace IO.Swagger.Model
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class InlineResponse200 {\n");
|
||||
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Category: ").Append(Category).Append("\n");
|
||||
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
||||
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -155,14 +166,9 @@ namespace IO.Swagger.Model
|
||||
|
||||
return
|
||||
(
|
||||
this.PhotoUrls == other.PhotoUrls ||
|
||||
this.PhotoUrls != null &&
|
||||
this.PhotoUrls.SequenceEqual(other.PhotoUrls)
|
||||
) &&
|
||||
(
|
||||
this.Name == other.Name ||
|
||||
this.Name != null &&
|
||||
this.Name.Equals(other.Name)
|
||||
this.Tags == other.Tags ||
|
||||
this.Tags != null &&
|
||||
this.Tags.SequenceEqual(other.Tags)
|
||||
) &&
|
||||
(
|
||||
this.Id == other.Id ||
|
||||
@ -174,15 +180,20 @@ namespace IO.Swagger.Model
|
||||
this.Category != null &&
|
||||
this.Category.Equals(other.Category)
|
||||
) &&
|
||||
(
|
||||
this.Tags == other.Tags ||
|
||||
this.Tags != null &&
|
||||
this.Tags.SequenceEqual(other.Tags)
|
||||
) &&
|
||||
(
|
||||
this.Status == other.Status ||
|
||||
this.Status != null &&
|
||||
this.Status.Equals(other.Status)
|
||||
) &&
|
||||
(
|
||||
this.Name == other.Name ||
|
||||
this.Name != null &&
|
||||
this.Name.Equals(other.Name)
|
||||
) &&
|
||||
(
|
||||
this.PhotoUrls == other.PhotoUrls ||
|
||||
this.PhotoUrls != null &&
|
||||
this.PhotoUrls.SequenceEqual(other.PhotoUrls)
|
||||
);
|
||||
}
|
||||
|
||||
@ -197,21 +208,28 @@ namespace IO.Swagger.Model
|
||||
{
|
||||
int hash = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
if (this.PhotoUrls != null)
|
||||
hash = hash * 59 + this.PhotoUrls.GetHashCode();
|
||||
if (this.Name != null)
|
||||
hash = hash * 59 + this.Name.GetHashCode();
|
||||
if (this.Id != null)
|
||||
hash = hash * 59 + this.Id.GetHashCode();
|
||||
if (this.Category != null)
|
||||
hash = hash * 59 + this.Category.GetHashCode();
|
||||
|
||||
if (this.Tags != null)
|
||||
hash = hash * 59 + this.Tags.GetHashCode();
|
||||
|
||||
if (this.Id != null)
|
||||
hash = hash * 59 + this.Id.GetHashCode();
|
||||
|
||||
if (this.Category != null)
|
||||
hash = hash * 59 + this.Category.GetHashCode();
|
||||
|
||||
if (this.Status != null)
|
||||
hash = hash * 59 + this.Status.GetHashCode();
|
||||
|
||||
if (this.Name != null)
|
||||
hash = hash * 59 + this.Name.GetHashCode();
|
||||
|
||||
if (this.PhotoUrls != null)
|
||||
hash = hash * 59 + this.PhotoUrls.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,26 +17,23 @@ namespace IO.Swagger.Model
|
||||
[DataContract]
|
||||
public partial class Model200Response : IEquatable<Model200Response>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Model200Response" /> class.
|
||||
/// Initializes a new instance of the <see cref="Model200Response" />class.
|
||||
/// </summary>
|
||||
/// <param name="Name">Name.</param>
|
||||
|
||||
public Model200Response(int? Name = null)
|
||||
{
|
||||
this.Name = Name;
|
||||
|
||||
|
||||
this.Name = Name;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public int? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -105,6 +102,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,26 +17,23 @@ namespace IO.Swagger.Model
|
||||
[DataContract]
|
||||
public partial class ModelReturn : IEquatable<ModelReturn>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModelReturn" /> class.
|
||||
/// Initializes a new instance of the <see cref="ModelReturn" />class.
|
||||
/// </summary>
|
||||
/// <param name="_Return">_Return.</param>
|
||||
|
||||
public ModelReturn(int? _Return = null)
|
||||
{
|
||||
this._Return = _Return;
|
||||
|
||||
|
||||
this._Return = _Return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets _Return
|
||||
/// </summary>
|
||||
[DataMember(Name="return", EmitDefaultValue=false)]
|
||||
public int? _Return { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -105,6 +102,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,14 +17,11 @@ namespace IO.Swagger.Model
|
||||
[DataContract]
|
||||
public partial class Name : IEquatable<Name>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Name" /> class.
|
||||
/// Initializes a new instance of the <see cref="Name" />class.
|
||||
/// </summary>
|
||||
/// <param name="_Name">_Name (required).</param>
|
||||
/// <param name="Property">Property.</param>
|
||||
|
||||
public Name(int? _Name = null, string Property = null)
|
||||
{
|
||||
// to ensure "_Name" is required (not null)
|
||||
@ -36,29 +33,27 @@ namespace IO.Swagger.Model
|
||||
{
|
||||
this._Name = _Name;
|
||||
}
|
||||
this.Property = Property;
|
||||
|
||||
|
||||
this.Property = Property;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets _Name
|
||||
/// </summary>
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public int? _Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets SnakeCase
|
||||
/// </summary>
|
||||
[DataMember(Name="snake_case", EmitDefaultValue=false)]
|
||||
public int? SnakeCase { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Property
|
||||
/// </summary>
|
||||
[DataMember(Name="property", EmitDefaultValue=false)]
|
||||
public string Property { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -68,8 +63,8 @@ namespace IO.Swagger.Model
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Name {\n");
|
||||
sb.Append(" _Name: ").Append(_Name).Append("\n");
|
||||
sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n");
|
||||
sb.Append(" Property: ").Append(Property).Append("\n");
|
||||
sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n");
|
||||
sb.Append(" Property: ").Append(Property).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -143,6 +138,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,40 +12,46 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Order
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Order : IEquatable<Order>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Order Status
|
||||
/// </summary>
|
||||
/// <value>Order Status</value>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum StatusEnum {
|
||||
public enum StatusEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum Placed for "placed"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "placed")]
|
||||
Placed,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Approved for "approved"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "approved")]
|
||||
Approved,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Delivered for "delivered"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "delivered")]
|
||||
Delivered
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Order Status
|
||||
/// </summary>
|
||||
/// <value>Order Status</value>
|
||||
[DataMember(Name="status", EmitDefaultValue=false)]
|
||||
public StatusEnum? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Order" /> class.
|
||||
/// Initializes a new instance of the <see cref="Order" />class.
|
||||
/// </summary>
|
||||
/// <param name="Id">Id.</param>
|
||||
/// <param name="PetId">PetId.</param>
|
||||
@ -53,14 +59,20 @@ namespace IO.Swagger.Model
|
||||
/// <param name="ShipDate">ShipDate.</param>
|
||||
/// <param name="Status">Order Status.</param>
|
||||
/// <param name="Complete">Complete (default to false).</param>
|
||||
|
||||
public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null)
|
||||
{
|
||||
this.Id = Id;
|
||||
this.PetId = PetId;
|
||||
this.Quantity = Quantity;
|
||||
this.ShipDate = ShipDate;
|
||||
this.Status = Status;
|
||||
|
||||
|
||||
this.Id = Id;
|
||||
|
||||
this.PetId = PetId;
|
||||
|
||||
this.Quantity = Quantity;
|
||||
|
||||
this.ShipDate = ShipDate;
|
||||
|
||||
this.Status = Status;
|
||||
|
||||
// use default value if no "Complete" provided
|
||||
if (Complete == null)
|
||||
{
|
||||
@ -73,37 +85,31 @@ namespace IO.Swagger.Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets PetId
|
||||
/// </summary>
|
||||
[DataMember(Name="petId", EmitDefaultValue=false)]
|
||||
public long? PetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Quantity
|
||||
/// </summary>
|
||||
[DataMember(Name="quantity", EmitDefaultValue=false)]
|
||||
public int? Quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets ShipDate
|
||||
/// </summary>
|
||||
[DataMember(Name="shipDate", EmitDefaultValue=false)]
|
||||
public DateTime? ShipDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Complete
|
||||
/// </summary>
|
||||
[DataMember(Name="complete", EmitDefaultValue=false)]
|
||||
public bool? Complete { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -113,11 +119,11 @@ namespace IO.Swagger.Model
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Order {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" PetId: ").Append(PetId).Append("\n");
|
||||
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
|
||||
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
sb.Append(" Complete: ").Append(Complete).Append("\n");
|
||||
sb.Append(" PetId: ").Append(PetId).Append("\n");
|
||||
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
|
||||
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
sb.Append(" Complete: ").Append(Complete).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -212,6 +218,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,40 +12,46 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Pet
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Pet : IEquatable<Pet>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// pet status in the store
|
||||
/// </summary>
|
||||
/// <value>pet status in the store</value>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum StatusEnum {
|
||||
public enum StatusEnum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum Available for "available"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "available")]
|
||||
Available,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Pending for "pending"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "pending")]
|
||||
Pending,
|
||||
|
||||
/// <summary>
|
||||
/// Enum Sold for "sold"
|
||||
/// </summary>
|
||||
[EnumMember(Value = "sold")]
|
||||
Sold
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// pet status in the store
|
||||
/// </summary>
|
||||
/// <value>pet status in the store</value>
|
||||
[DataMember(Name="status", EmitDefaultValue=false)]
|
||||
public StatusEnum? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Pet" /> class.
|
||||
/// Initializes a new instance of the <see cref="Pet" />class.
|
||||
/// </summary>
|
||||
/// <param name="Id">Id.</param>
|
||||
/// <param name="Category">Category.</param>
|
||||
@ -53,7 +59,6 @@ namespace IO.Swagger.Model
|
||||
/// <param name="PhotoUrls">PhotoUrls (required).</param>
|
||||
/// <param name="Tags">Tags.</param>
|
||||
/// <param name="Status">pet status in the store.</param>
|
||||
|
||||
public Pet(long? Id = null, Category Category = null, string Name = null, List<string> PhotoUrls = null, List<Tag> Tags = null, StatusEnum? Status = null)
|
||||
{
|
||||
// to ensure "Name" is required (not null)
|
||||
@ -74,44 +79,43 @@ namespace IO.Swagger.Model
|
||||
{
|
||||
this.PhotoUrls = PhotoUrls;
|
||||
}
|
||||
this.Id = Id;
|
||||
this.Category = Category;
|
||||
this.Tags = Tags;
|
||||
this.Status = Status;
|
||||
|
||||
|
||||
this.Id = Id;
|
||||
|
||||
this.Category = Category;
|
||||
|
||||
this.Tags = Tags;
|
||||
|
||||
this.Status = Status;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Category
|
||||
/// </summary>
|
||||
[DataMember(Name="category", EmitDefaultValue=false)]
|
||||
public Category Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets PhotoUrls
|
||||
/// </summary>
|
||||
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
||||
public List<string> PhotoUrls { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Tags
|
||||
/// </summary>
|
||||
[DataMember(Name="tags", EmitDefaultValue=false)]
|
||||
public List<Tag> Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -121,11 +125,11 @@ namespace IO.Swagger.Model
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Pet {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Category: ").Append(Category).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
||||
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
sb.Append(" Category: ").Append(Category).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
||||
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -220,6 +224,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,31 +12,28 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// SpecialModelName
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class SpecialModelName : IEquatable<SpecialModelName>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SpecialModelName" /> class.
|
||||
/// Initializes a new instance of the <see cref="SpecialModelName" />class.
|
||||
/// </summary>
|
||||
/// <param name="SpecialPropertyName">SpecialPropertyName.</param>
|
||||
|
||||
public SpecialModelName(long? SpecialPropertyName = null)
|
||||
{
|
||||
this.SpecialPropertyName = SpecialPropertyName;
|
||||
|
||||
|
||||
this.SpecialPropertyName = SpecialPropertyName;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets SpecialPropertyName
|
||||
/// </summary>
|
||||
[DataMember(Name="$special[property.name]", EmitDefaultValue=false)]
|
||||
public long? SpecialPropertyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -105,6 +102,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,39 +12,36 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Tag
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class Tag : IEquatable<Tag>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Tag" /> class.
|
||||
/// Initializes a new instance of the <see cref="Tag" />class.
|
||||
/// </summary>
|
||||
/// <param name="Id">Id.</param>
|
||||
/// <param name="Name">Name.</param>
|
||||
|
||||
public Tag(long? Id = null, string Name = null)
|
||||
{
|
||||
this.Id = Id;
|
||||
this.Name = Name;
|
||||
|
||||
|
||||
this.Id = Id;
|
||||
|
||||
this.Name = Name;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Name
|
||||
/// </summary>
|
||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -54,7 +51,7 @@ namespace IO.Swagger.Model
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class Tag {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -121,6 +118,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,15 +12,13 @@ using Newtonsoft.Json.Converters;
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// User
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class User : IEquatable<User>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="User" /> class.
|
||||
/// Initializes a new instance of the <see cref="User" />class.
|
||||
/// </summary>
|
||||
/// <param name="Id">Id.</param>
|
||||
/// <param name="Username">Username.</param>
|
||||
@ -30,70 +28,69 @@ namespace IO.Swagger.Model
|
||||
/// <param name="Password">Password.</param>
|
||||
/// <param name="Phone">Phone.</param>
|
||||
/// <param name="UserStatus">User Status.</param>
|
||||
|
||||
public User(long? Id = null, string Username = null, string FirstName = null, string LastName = null, string Email = null, string Password = null, string Phone = null, int? UserStatus = null)
|
||||
{
|
||||
this.Id = Id;
|
||||
this.Username = Username;
|
||||
this.FirstName = FirstName;
|
||||
this.LastName = LastName;
|
||||
this.Email = Email;
|
||||
this.Password = Password;
|
||||
this.Phone = Phone;
|
||||
this.UserStatus = UserStatus;
|
||||
|
||||
|
||||
this.Id = Id;
|
||||
|
||||
this.Username = Username;
|
||||
|
||||
this.FirstName = FirstName;
|
||||
|
||||
this.LastName = LastName;
|
||||
|
||||
this.Email = Email;
|
||||
|
||||
this.Password = Password;
|
||||
|
||||
this.Phone = Phone;
|
||||
|
||||
this.UserStatus = UserStatus;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Id
|
||||
/// </summary>
|
||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Username
|
||||
/// </summary>
|
||||
[DataMember(Name="username", EmitDefaultValue=false)]
|
||||
public string Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets FirstName
|
||||
/// </summary>
|
||||
[DataMember(Name="firstName", EmitDefaultValue=false)]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets LastName
|
||||
/// </summary>
|
||||
[DataMember(Name="lastName", EmitDefaultValue=false)]
|
||||
public string LastName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Email
|
||||
/// </summary>
|
||||
[DataMember(Name="email", EmitDefaultValue=false)]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Password
|
||||
/// </summary>
|
||||
[DataMember(Name="password", EmitDefaultValue=false)]
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Phone
|
||||
/// </summary>
|
||||
[DataMember(Name="phone", EmitDefaultValue=false)]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User Status
|
||||
/// </summary>
|
||||
/// <value>User Status</value>
|
||||
[DataMember(Name="userStatus", EmitDefaultValue=false)]
|
||||
public int? UserStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -103,13 +100,13 @@ namespace IO.Swagger.Model
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class User {\n");
|
||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||
sb.Append(" Username: ").Append(Username).Append("\n");
|
||||
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
||||
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
||||
sb.Append(" Email: ").Append(Email).Append("\n");
|
||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||
sb.Append(" Phone: ").Append(Phone).Append("\n");
|
||||
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
|
||||
sb.Append(" Username: ").Append(Username).Append("\n");
|
||||
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
||||
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
||||
sb.Append(" Email: ").Append(Email).Append("\n");
|
||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||
sb.Append(" Phone: ").Append(Phone).Append("\n");
|
||||
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -218,6 +215,6 @@ namespace IO.Swagger.Model
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -69,9 +69,10 @@
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Animal.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Cat.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Dog.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\EnumClass.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\EnumTest.cs" />
|
||||
<Compile Include="TestEnum.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\ApiResponse.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\CatDogTest.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\TagCategoryTest.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\FormatTest.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
@ -1,11 +1,11 @@
|
||||
<Properties StartupItem="SwaggerClientTest.csproj">
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs">
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs">
|
||||
<Files>
|
||||
<File FileName="TestPet.cs" Line="47" Column="17" />
|
||||
<File FileName="TestOrder.cs" Line="1" Column="1" />
|
||||
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs" Line="1" Column="1" />
|
||||
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/FormatTest.cs" Line="1" Column="1" />
|
||||
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs" Line="18" Column="58" />
|
||||
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs" Line="1" Column="1" />
|
||||
<File FileName="TestEnum.cs" Line="28" Column="75" />
|
||||
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs" Line="1" Column="1" />
|
||||
</Files>
|
||||
</MonoDevelop.Ide.Workbench>
|
||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
|
39
samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs
Normal file
39
samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using IO.Swagger.Api;
|
||||
using IO.Swagger.Model;
|
||||
using IO.Swagger.Client;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SwaggerClientTest.TestEnum
|
||||
{
|
||||
[TestFixture ()]
|
||||
public class TestEnum
|
||||
{
|
||||
public TestEnum ()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test EnumClass
|
||||
/// </summary>
|
||||
[Test ()]
|
||||
public void TestEnumClass ()
|
||||
{
|
||||
// test serialization for string
|
||||
Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumClass.Abc), "\"_abc\"");
|
||||
|
||||
// test serialization for number
|
||||
Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1), "\"-1\"");
|
||||
|
||||
// test cast to int
|
||||
Assert.AreEqual ((int)EnumTest.EnumIntegerEnum.NUMBER_MINUS_1, -1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,14 +73,14 @@ namespace SwaggerClientTest.TestOrder
|
||||
|
||||
}
|
||||
|
||||
/* comment out the test case as the method is not defined in original petstore spec
|
||||
* we will re-enable this after updating the petstore server
|
||||
*
|
||||
/*
|
||||
* Skip the following test as the fake endpiont has been removed from the swagger spec
|
||||
* We'll uncomment below after we update the Petstore server
|
||||
/// <summary>
|
||||
/// Test GetInvetoryInObject
|
||||
/// Test TestGetInventoryInObject
|
||||
/// </summary>
|
||||
[Test ()]
|
||||
public void TestGetInventoryInObject ()
|
||||
public void TestGetInventoryInObject()
|
||||
{
|
||||
// set timeout to 10 seconds
|
||||
Configuration c1 = new Configuration (timeout: 10000);
|
||||
@ -95,9 +95,18 @@ namespace SwaggerClientTest.TestOrder
|
||||
{
|
||||
Assert.IsInstanceOf (typeof(int?), Int32.Parse(entry.Value));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}*/
|
||||
/// <summary>
|
||||
/// Test Enum
|
||||
/// </summary>
|
||||
[Test ()]
|
||||
public void TestEnum ()
|
||||
{
|
||||
Assert.AreEqual (Order.StatusEnum.Approved.ToString(), "Approved");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs
|
||||
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png
|
||||
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll
|
||||
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll
|
||||
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll
|
||||
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb
|
||||
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
|
||||
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll
|
||||
/Users/williamcheng/Code/wing328/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
|
162
samples/client/petstore/go/user_api_test.go
Normal file
162
samples/client/petstore/go/user_api_test.go
Normal file
@ -0,0 +1,162 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
sw "./go-petstore"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCreateUser(t *testing.T) {
|
||||
s := sw.NewUserApi()
|
||||
newUser := sw.User{
|
||||
Id: 1000,
|
||||
FirstName: "gopher",
|
||||
LastName : "lang",
|
||||
Username : "gopher",
|
||||
Password : "lang",
|
||||
Email : "lang@test.com",
|
||||
Phone : "5101112222",
|
||||
UserStatus: 1}
|
||||
|
||||
apiResponse, err := s.CreateUser(newUser)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error while adding user")
|
||||
t.Log(err)
|
||||
}
|
||||
if apiResponse.Response.StatusCode != 200 {
|
||||
t.Log(apiResponse.Response)
|
||||
}
|
||||
}
|
||||
|
||||
//adding x to skip the test, currently it is failing
|
||||
func TestCreateUsersWithArrayInput(t *testing.T) {
|
||||
s := sw.NewUserApi()
|
||||
newUsers := []sw.User{
|
||||
sw.User {
|
||||
Id: int64(1001),
|
||||
FirstName: "gopher1",
|
||||
LastName : "lang1",
|
||||
Username : "gopher1",
|
||||
Password : "lang1",
|
||||
Email : "lang1@test.com",
|
||||
Phone : "5101112222",
|
||||
UserStatus: int32(1),
|
||||
},
|
||||
sw.User {
|
||||
Id: int64(1002),
|
||||
FirstName: "gopher2",
|
||||
LastName : "lang2",
|
||||
Username : "gopher2",
|
||||
Password : "lang2",
|
||||
Email : "lang2@test.com",
|
||||
Phone : "5101112222",
|
||||
UserStatus: int32(1),
|
||||
},
|
||||
}
|
||||
|
||||
apiResponse, err := s.CreateUsersWithArrayInput(newUsers)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error while adding users")
|
||||
t.Log(err)
|
||||
}
|
||||
if apiResponse.Response.StatusCode != 200 {
|
||||
t.Log(apiResponse.Response)
|
||||
}
|
||||
|
||||
//tear down
|
||||
_, err1 := s.DeleteUser("gopher1")
|
||||
if(err1 != nil){
|
||||
t.Errorf("Error while deleting user")
|
||||
t.Log(err1)
|
||||
}
|
||||
|
||||
_, err2 := s.DeleteUser("gopher2")
|
||||
if(err2 != nil){
|
||||
t.Errorf("Error while deleting user")
|
||||
t.Log(err2)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetUserByName(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
s := sw.NewUserApi()
|
||||
resp, apiResponse, err := s.GetUserByName("gopher")
|
||||
if err != nil {
|
||||
t.Errorf("Error while getting user by id")
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(resp.Id, int64(1000), "User id should be equal")
|
||||
assert.Equal(resp.Username, "gopher", "User name should be gopher")
|
||||
assert.Equal(resp.LastName, "lang", "Last name should be lang")
|
||||
//t.Log(resp)
|
||||
}
|
||||
if apiResponse.Response.StatusCode != 200 {
|
||||
t.Log(apiResponse.Response)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetUserByNameWithInvalidID(t *testing.T) {
|
||||
s := sw.NewUserApi()
|
||||
resp, apiResponse, err := s.GetUserByName("999999999")
|
||||
if err != nil {
|
||||
t.Errorf("Error while getting user by invalid id")
|
||||
t.Log(err)
|
||||
t.Log(apiResponse)
|
||||
} else {
|
||||
t.Log(resp)
|
||||
}
|
||||
if apiResponse.Response.StatusCode != 200 {
|
||||
t.Log(apiResponse.Response)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateUser(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
s := sw.NewUserApi()
|
||||
newUser := sw.User{
|
||||
Id: 1000,
|
||||
FirstName: "gopher20",
|
||||
LastName : "lang20",
|
||||
Username : "gopher",
|
||||
Password : "lang",
|
||||
Email : "lang@test.com",
|
||||
Phone : "5101112222",
|
||||
UserStatus: 1}
|
||||
|
||||
apiResponse, err := s.UpdateUser("gopher", newUser)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error while deleting user by id")
|
||||
t.Log(err)
|
||||
}
|
||||
if apiResponse.Response.StatusCode != 200 {
|
||||
t.Log(apiResponse.Response)
|
||||
}
|
||||
|
||||
//verify changings are correct
|
||||
resp, apiResponse, err := s.GetUserByName("gopher")
|
||||
if err != nil {
|
||||
t.Errorf("Error while getting user by id")
|
||||
t.Log(err)
|
||||
} else {
|
||||
assert.Equal(resp.Id, int64(1000), "User id should be equal")
|
||||
assert.Equal(resp.FirstName, "gopher20", "User name should be gopher")
|
||||
assert.Equal(resp.Password, "lang", "User name should be the same")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteUser(t *testing.T) {
|
||||
s := sw.NewUserApi()
|
||||
apiResponse, err := s.DeleteUser("gopher")
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error while deleting user")
|
||||
t.Log(err)
|
||||
}
|
||||
if apiResponse.Response.StatusCode != 200 {
|
||||
t.Log(apiResponse.Response)
|
||||
}
|
||||
}
|
8
samples/client/petstore/java/default/docs/EnumClass.md
Normal file
8
samples/client/petstore/java/default/docs/EnumClass.md
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
# EnumClass
|
||||
|
||||
## Enum
|
||||
|
||||
* `{values=[_abc, -efg, (xyz)], enumVars=[{name=_ABC, value="_abc"}, {name=_EFG, value="-efg"}, {name=_XYZ_, value="(xyz)"}]}`
|
||||
|
||||
|
36
samples/client/petstore/java/default/docs/EnumTest.md
Normal file
36
samples/client/petstore/java/default/docs/EnumTest.md
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
# EnumTest
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional]
|
||||
**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional]
|
||||
**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional]
|
||||
|
||||
|
||||
<a name="EnumStringEnum"></a>
|
||||
## Enum: EnumStringEnum
|
||||
Name | Value
|
||||
---- | -----
|
||||
UPPER | "UPPER"
|
||||
LOWER | "lower"
|
||||
|
||||
|
||||
<a name="EnumIntegerEnum"></a>
|
||||
## Enum: EnumIntegerEnum
|
||||
Name | Value
|
||||
---- | -----
|
||||
NUMBER_1 | 1
|
||||
NUMBER_MINUS_1 | -1
|
||||
|
||||
|
||||
<a name="EnumNumberEnum"></a>
|
||||
## Enum: EnumNumberEnum
|
||||
Name | Value
|
||||
---- | -----
|
||||
NUMBER_1_DOT_1 | 1.1
|
||||
NUMBER_MINUS_1_DOT_2 | -1.2
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ Fake endpoint for testing various parameters
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
String number = "number_example"; // String | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String string = "string_example"; // String | None
|
||||
byte[] _byte = B; // byte[] | None
|
||||
@ -47,7 +47,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**number** | **BigDecimal**| None |
|
||||
**number** | **String**| None |
|
||||
**_double** | **Double**| None |
|
||||
**string** | **String**| None |
|
||||
**_byte** | **byte[]**| None |
|
||||
|
@ -15,7 +15,6 @@ Name | Type | Description | Notes
|
||||
**binary** | **byte[]** | | [optional]
|
||||
**date** | [**Date**](Date.md) | |
|
||||
**dateTime** | [**Date**](Date.md) | | [optional]
|
||||
**uuid** | **String** | | [optional]
|
||||
**password** | **String** | |
|
||||
|
||||
|
||||
|
@ -16,9 +16,9 @@ Name | Type | Description | Notes
|
||||
## Enum: StatusEnum
|
||||
Name | Value
|
||||
---- | -----
|
||||
PLACED | placed
|
||||
APPROVED | approved
|
||||
DELIVERED | delivered
|
||||
PLACED | "placed"
|
||||
APPROVED | "approved"
|
||||
DELIVERED | "delivered"
|
||||
|
||||
|
||||
|
||||
|
@ -16,9 +16,9 @@ Name | Type | Description | Notes
|
||||
## Enum: StatusEnum
|
||||
Name | Value
|
||||
---- | -----
|
||||
AVAILABLE | available
|
||||
PENDING | pending
|
||||
SOLD | sold
|
||||
AVAILABLE | "available"
|
||||
PENDING | "pending"
|
||||
SOLD | "sold"
|
||||
|
||||
|
||||
|
||||
|
@ -8,7 +8,6 @@ import io.swagger.client.Configuration;
|
||||
import io.swagger.client.Pair;
|
||||
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -52,7 +51,7 @@ public class FakeApi {
|
||||
* @param password None (optional)
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public void testEndpointParameters(BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException {
|
||||
public void testEndpointParameters(String number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) throws ApiException {
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// verify the required parameter 'number' is set
|
||||
|
@ -6,9 +6,9 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Animal
|
||||
*/
|
||||
|
||||
public class Animal {
|
||||
|
||||
|
@ -7,9 +7,9 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Cat
|
||||
*/
|
||||
|
||||
public class Cat extends Animal {
|
||||
|
||||
|
@ -6,9 +6,9 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Category
|
||||
*/
|
||||
|
||||
public class Category {
|
||||
|
||||
|
@ -7,9 +7,9 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Dog
|
||||
*/
|
||||
|
||||
public class Dog extends Animal {
|
||||
|
||||
|
@ -0,0 +1,27 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
||||
/**
|
||||
* Gets or Sets EnumClass
|
||||
*/
|
||||
public enum EnumClass {
|
||||
_ABC("_abc"),
|
||||
_EFG("-efg"),
|
||||
_XYZ_("(xyz)");
|
||||
|
||||
private String value;
|
||||
|
||||
EnumClass(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,177 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
/**
|
||||
* EnumTest
|
||||
*/
|
||||
|
||||
public class EnumTest {
|
||||
|
||||
|
||||
/**
|
||||
* Gets or Sets enumString
|
||||
*/
|
||||
public enum EnumStringEnum {
|
||||
UPPER("UPPER"),
|
||||
LOWER("lower");
|
||||
|
||||
private String value;
|
||||
|
||||
EnumStringEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
||||
private EnumStringEnum enumString = null;
|
||||
|
||||
/**
|
||||
* Gets or Sets enumInteger
|
||||
*/
|
||||
public enum EnumIntegerEnum {
|
||||
NUMBER_1(1),
|
||||
NUMBER_MINUS_1(-1);
|
||||
|
||||
private Integer value;
|
||||
|
||||
EnumIntegerEnum(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
||||
private EnumIntegerEnum enumInteger = null;
|
||||
|
||||
/**
|
||||
* Gets or Sets enumNumber
|
||||
*/
|
||||
public enum EnumNumberEnum {
|
||||
NUMBER_1_DOT_1(1.1),
|
||||
NUMBER_MINUS_1_DOT_2(-1.2);
|
||||
|
||||
private Double value;
|
||||
|
||||
EnumNumberEnum(Double value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
||||
private EnumNumberEnum enumNumber = null;
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public EnumTest enumString(EnumStringEnum enumString) {
|
||||
this.enumString = enumString;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("enum_string")
|
||||
public EnumStringEnum getEnumString() {
|
||||
return enumString;
|
||||
}
|
||||
public void setEnumString(EnumStringEnum enumString) {
|
||||
this.enumString = enumString;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public EnumTest enumInteger(EnumIntegerEnum enumInteger) {
|
||||
this.enumInteger = enumInteger;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("enum_integer")
|
||||
public EnumIntegerEnum getEnumInteger() {
|
||||
return enumInteger;
|
||||
}
|
||||
public void setEnumInteger(EnumIntegerEnum enumInteger) {
|
||||
this.enumInteger = enumInteger;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
**/
|
||||
public EnumTest enumNumber(EnumNumberEnum enumNumber) {
|
||||
this.enumNumber = enumNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
@JsonProperty("enum_number")
|
||||
public EnumNumberEnum getEnumNumber() {
|
||||
return enumNumber;
|
||||
}
|
||||
public void setEnumNumber(EnumNumberEnum enumNumber) {
|
||||
this.enumNumber = enumNumber;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
EnumTest enumTest = (EnumTest) o;
|
||||
return Objects.equals(this.enumString, enumTest.enumString) &&
|
||||
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
|
||||
Objects.equals(this.enumNumber, enumTest.enumNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(enumString, enumInteger, enumNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class EnumTest {\n");
|
||||
|
||||
sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n");
|
||||
sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n");
|
||||
sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(java.lang.Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* FormatTest
|
||||
*/
|
||||
|
||||
public class FormatTest {
|
||||
|
||||
|
@ -6,11 +6,9 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Model for testing model name starting with number
|
||||
**/
|
||||
|
||||
*/
|
||||
@ApiModel(description = "Model for testing model name starting with number")
|
||||
|
||||
public class Model200Response {
|
||||
|
@ -6,9 +6,9 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ModelApiResponse
|
||||
*/
|
||||
|
||||
public class ModelApiResponse {
|
||||
|
||||
|
@ -6,11 +6,9 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Model for testing reserved words
|
||||
**/
|
||||
|
||||
*/
|
||||
@ApiModel(description = "Model for testing reserved words")
|
||||
|
||||
public class ModelReturn {
|
||||
|
@ -6,11 +6,9 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Model for testing model name same as property name
|
||||
**/
|
||||
|
||||
*/
|
||||
@ApiModel(description = "Model for testing model name same as property name")
|
||||
|
||||
public class Name {
|
||||
|
@ -8,9 +8,9 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Order
|
||||
*/
|
||||
|
||||
public class Order {
|
||||
|
||||
@ -19,7 +19,9 @@ public class Order {
|
||||
private Integer quantity = null;
|
||||
private Date shipDate = null;
|
||||
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
*/
|
||||
public enum StatusEnum {
|
||||
PLACED("placed"),
|
||||
APPROVED("approved"),
|
||||
@ -34,7 +36,7 @@ public class Order {
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Pet
|
||||
*/
|
||||
|
||||
public class Pet {
|
||||
|
||||
@ -23,7 +23,9 @@ public class Pet {
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
public enum StatusEnum {
|
||||
AVAILABLE("available"),
|
||||
PENDING("pending"),
|
||||
@ -38,7 +40,7 @@ public class Pet {
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,9 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* SpecialModelName
|
||||
*/
|
||||
|
||||
public class SpecialModelName {
|
||||
|
||||
|
@ -6,9 +6,9 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Tag
|
||||
*/
|
||||
|
||||
public class Tag {
|
||||
|
||||
|
@ -6,9 +6,9 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* User
|
||||
*/
|
||||
|
||||
public class User {
|
||||
|
||||
|
@ -14,7 +14,7 @@ import feign.codec.EncodeException;
|
||||
import feign.codec.Encoder;
|
||||
import feign.RequestTemplate;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00")
|
||||
public class FormAwareEncoder implements Encoder {
|
||||
public static final String UTF_8 = "utf-8";
|
||||
private static final String LINE_FEED = "\r\n";
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
@ -0,0 +1,40 @@
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.client.ApiClient;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import feign.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00")
|
||||
public interface FakeApi extends ApiClient.Api {
|
||||
|
||||
|
||||
/**
|
||||
* Fake endpoint for testing various parameters
|
||||
* Fake endpoint for testing various parameters
|
||||
* @param number None (required)
|
||||
* @param _double None (required)
|
||||
* @param string None (required)
|
||||
* @param _byte None (required)
|
||||
* @param integer None (optional)
|
||||
* @param int32 None (optional)
|
||||
* @param int64 None (optional)
|
||||
* @param _float None (optional)
|
||||
* @param binary None (optional)
|
||||
* @param date None (optional)
|
||||
* @param dateTime None (optional)
|
||||
* @param password None (optional)
|
||||
* @return void
|
||||
*/
|
||||
@RequestLine("POST /fake")
|
||||
@Headers({
|
||||
"Content-type: application/x-www-form-urlencoded",
|
||||
"Accepts: application/json",
|
||||
})
|
||||
void testEndpointParameters(@Param("number") String number, @Param("_double") Double _double, @Param("string") String string, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("binary") byte[] binary, @Param("date") Date date, @Param("dateTime") Date dateTime, @Param("password") String password);
|
||||
}
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import feign.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00")
|
||||
public interface PetApi extends ApiClient.Api {
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import feign.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00")
|
||||
public interface StoreApi extends ApiClient.Api {
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import feign.*;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00")
|
||||
public interface UserApi extends ApiClient.Api {
|
||||
|
||||
|
||||
|
@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00")
|
||||
/**
|
||||
* Animal
|
||||
*/
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00")
|
||||
public class Animal {
|
||||
|
||||
private String className = null;
|
||||
|
@ -7,10 +7,10 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-23T12:48:24.088+08:00")
|
||||
/**
|
||||
* Cat
|
||||
*/
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-04-27T23:17:22.230+08:00")
|
||||
public class Cat extends Animal {
|
||||
|
||||
private String className = null;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user