This commit is contained in:
wing328 2017-10-29 15:15:10 +08:00
commit 1c201fe7ec
462 changed files with 26319 additions and 6676 deletions

View File

@ -0,0 +1,3 @@
{
"targetFramework": "v4.0"
}

31
bin/csharp-petstore-net-40.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
SCRIPT="$0"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
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 $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientNet40 --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-40.json"
java $JAVA_OPTS -jar $executable $ags

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead. # 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" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C}" ags="generate $@ -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientNet40 --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-40.json"
java $JAVA_OPTS -jar $executable $ags java $JAVA_OPTS -jar $executable $ags

0
bin/typescript-angular-petstore-all.sh Normal file → Executable file
View File

View File

@ -15,6 +15,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
@SuppressWarnings({"hiding"}) @SuppressWarnings({"hiding"})
private static final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class); private static final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class);
private static final String NET45 = "v4.5"; private static final String NET45 = "v4.5";
private static final String NET40 = "v4.0";
private static final String NET35 = "v3.5"; private static final String NET35 = "v3.5";
private static final String NETSTANDARD = "v5.0"; private static final String NETSTANDARD = "v5.0";
private static final String UWP = "uwp"; private static final String UWP = "uwp";
@ -75,6 +76,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
); );
frameworks = new ImmutableMap.Builder<String, String>() frameworks = new ImmutableMap.Builder<String, String>()
.put(NET35, ".NET Framework 3.5 compatible") .put(NET35, ".NET Framework 3.5 compatible")
.put(NET40, ".NET Framework 4.0 compatible")
.put(NET45, ".NET Framework 4.5+ compatible") .put(NET45, ".NET Framework 4.5+ compatible")
.put(NETSTANDARD, ".NET Standard 1.3 compatible") .put(NETSTANDARD, ".NET Standard 1.3 compatible")
.put(UWP, "Universal Windows Platform (IMPORTANT: this will be decommissioned and replaced by v5.0)") .put(UWP, "Universal Windows Platform (IMPORTANT: this will be decommissioned and replaced by v5.0)")
@ -227,7 +229,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
setSupportsUWP(Boolean.TRUE); setSupportsUWP(Boolean.TRUE);
additionalProperties.put("supportsAsync", this.supportsAsync); additionalProperties.put("supportsAsync", this.supportsAsync);
additionalProperties.put("supportsUWP", this.supportsUWP); additionalProperties.put("supportsUWP", this.supportsUWP);
} else if (NET40.equals(this.targetFramework)) {
setTargetFrameworkNuget("net40");
setSupportsAsync(Boolean.FALSE);
if (additionalProperties.containsKey("supportsAsync")) {
additionalProperties.remove("supportsAsync");
}
additionalProperties.put("isNet40", true);
} else { } else {
setTargetFrameworkNuget("net45"); setTargetFrameworkNuget("net45");
setSupportsAsync(Boolean.TRUE); setSupportsAsync(Boolean.TRUE);

View File

@ -2,7 +2,6 @@ package io.swagger.codegen.languages;
import io.swagger.codegen.*; import io.swagger.codegen.*;
import io.swagger.models.Model; import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.Operation; import io.swagger.models.Operation;
import io.swagger.models.Swagger; import io.swagger.models.Swagger;
import io.swagger.models.properties.*; import io.swagger.models.properties.*;
@ -10,8 +9,6 @@ import io.swagger.models.properties.*;
import java.util.*; import java.util.*;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils;
import io.swagger.models.auth.SecuritySchemeDefinition; import io.swagger.models.auth.SecuritySchemeDefinition;
import io.swagger.codegen.CliOption; import io.swagger.codegen.CliOption;
import io.swagger.codegen.CodegenConstants; import io.swagger.codegen.CodegenConstants;
@ -24,6 +21,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.tuple.Pair;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -38,12 +36,14 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
protected String defaultDateFormat = "%Y-%m-%d"; protected String defaultDateFormat = "%Y-%m-%d";
protected Boolean useMonadLogger = false; protected Boolean useMonadLogger = false;
protected Boolean genEnums = true;
// CLI PROPS // CLI PROPS
public static final String PROP_ALLOW_FROMJSON_NULLS = "allowFromJsonNulls"; public static final String PROP_ALLOW_FROMJSON_NULLS = "allowFromJsonNulls";
public static final String PROP_ALLOW_TOJSON_NULLS = "allowToJsonNulls"; public static final String PROP_ALLOW_TOJSON_NULLS = "allowToJsonNulls";
public static final String PROP_DATETIME_FORMAT = "dateTimeFormat"; public static final String PROP_DATETIME_FORMAT = "dateTimeFormat";
public static final String PROP_DATE_FORMAT = "dateFormat"; public static final String PROP_DATE_FORMAT = "dateFormat";
public static final String PROP_GENERATE_ENUMS = "generateEnums";
public static final String PROP_GENERATE_FORM_URLENCODED_INSTANCES = "generateFormUrlEncodedInstances"; public static final String PROP_GENERATE_FORM_URLENCODED_INSTANCES = "generateFormUrlEncodedInstances";
public static final String PROP_GENERATE_LENSES = "generateLenses"; public static final String PROP_GENERATE_LENSES = "generateLenses";
public static final String PROP_GENERATE_MODEL_CONSTRUCTORS = "generateModelConstructors"; public static final String PROP_GENERATE_MODEL_CONSTRUCTORS = "generateModelConstructors";
@ -62,9 +62,9 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
// vendor extensions // vendor extensions
static final String X_ALL_UNIQUE_PARAMS = "x-allUniqueParams"; static final String X_ALL_UNIQUE_PARAMS = "x-allUniqueParams";
static final String X_COLLECTION_FORMAT = "x-collectionFormat"; static final String X_COLLECTION_FORMAT = "x-collectionFormat";
static final String X_DUPLICATE = "x-duplicate";
static final String X_HADDOCK_PATH = "x-haddockPath"; static final String X_HADDOCK_PATH = "x-haddockPath";
static final String X_HAS_BODY_OR_FORM_PARAM = "x-hasBodyOrFormParam"; static final String X_HAS_BODY_OR_FORM_PARAM = "x-hasBodyOrFormParam";
static final String X_HAS_ENUM_SECTION = "x-hasEnumSection";
static final String X_HAS_MIME_FORM_URL_ENCODED = "x-hasMimeFormUrlEncoded"; static final String X_HAS_MIME_FORM_URL_ENCODED = "x-hasMimeFormUrlEncoded";
static final String X_HAS_NEW_TAG = "x-hasNewTag"; static final String X_HAS_NEW_TAG = "x-hasNewTag";
static final String X_HAS_OPTIONAL_PARAMS = "x-hasOptionalParams"; static final String X_HAS_OPTIONAL_PARAMS = "x-hasOptionalParams";
@ -72,7 +72,10 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
static final String X_HAS_UNKNOWN_RETURN = "x-hasUnknownReturn"; static final String X_HAS_UNKNOWN_RETURN = "x-hasUnknownReturn";
static final String X_INLINE_CONTENT_TYPE = "x-inlineContentType"; static final String X_INLINE_CONTENT_TYPE = "x-inlineContentType";
static final String X_IS_BODY_OR_FORM_PARAM = "x-isBodyOrFormParam"; static final String X_IS_BODY_OR_FORM_PARAM = "x-isBodyOrFormParam";
static final String X_IS_BODY_PARAM = "x-isBodyParam";
static final String X_MEDIA_DATA_TYPE = "x-mediaDataType"; static final String X_MEDIA_DATA_TYPE = "x-mediaDataType";
static final String X_DATA_TYPE = "x-dataType";
static final String X_ENUM_VALUES = "x-enumValues";
static final String X_MEDIA_IS_JSON = "x-mediaIsJson"; static final String X_MEDIA_IS_JSON = "x-mediaIsJson";
static final String X_MIME_TYPES = "x-mimeTypes"; static final String X_MIME_TYPES = "x-mimeTypes";
static final String X_OPERATION_TYPE = "x-operationType"; static final String X_OPERATION_TYPE = "x-operationType";
@ -82,14 +85,15 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
static final String X_STRICT_FIELDS = "x-strictFields"; static final String X_STRICT_FIELDS = "x-strictFields";
static final String X_UNKNOWN_MIME_TYPES = "x-unknownMimeTypes"; static final String X_UNKNOWN_MIME_TYPES = "x-unknownMimeTypes";
static final String X_USE_MONAD_LOGGER = "x-useMonadLogger"; static final String X_USE_MONAD_LOGGER = "x-useMonadLogger";
static final String X_NEWTYPE = "x-newtype";
static final String X_ENUM = "x-enum";
protected Map<String, CodegenParameter> uniqueParamsByName = new HashMap<String, CodegenParameter>(); protected ArrayList<Map<String,String>> unknownMimeTypes = new ArrayList<>();
protected Map<String, Map<String,Object>> uniqueParamNameTypes = new HashMap<>();
protected Map<String, Set<String>> modelMimeTypes = new HashMap<>();
protected Map<String, String> knownMimeDataTypes = new HashMap<>();
protected Set<String> typeNames = new HashSet<String>(); protected Set<String> typeNames = new HashSet<String>();
protected Map<String, String> knownMimeDataTypes = new HashMap<String, String>();
protected Map<String, Set<String>> modelMimeTypes = new HashMap<String, Set<String>>();
protected String lastTag = "";
protected ArrayList<Map<String,String>> unknownMimeTypes = new ArrayList<Map<String,String>>();
public CodegenType getTag() { public CodegenType getTag() {
return CodegenType.CLIENT; return CodegenType.CLIENT;
@ -212,6 +216,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
cliOptions.add(CliOption.newBoolean(PROP_ALLOW_TOJSON_NULLS, "allow emitting JSON Null during model encoding to JSON").defaultValue(Boolean.FALSE.toString())); cliOptions.add(CliOption.newBoolean(PROP_ALLOW_TOJSON_NULLS, "allow emitting JSON Null during model encoding to JSON").defaultValue(Boolean.FALSE.toString()));
cliOptions.add(CliOption.newBoolean(PROP_GENERATE_LENSES, "Generate Lens optics for Models").defaultValue(Boolean.TRUE.toString())); cliOptions.add(CliOption.newBoolean(PROP_GENERATE_LENSES, "Generate Lens optics for Models").defaultValue(Boolean.TRUE.toString()));
cliOptions.add(CliOption.newBoolean(PROP_GENERATE_MODEL_CONSTRUCTORS, "Generate smart constructors (only supply required fields) for models").defaultValue(Boolean.TRUE.toString())); cliOptions.add(CliOption.newBoolean(PROP_GENERATE_MODEL_CONSTRUCTORS, "Generate smart constructors (only supply required fields) for models").defaultValue(Boolean.TRUE.toString()));
cliOptions.add(CliOption.newBoolean(PROP_GENERATE_ENUMS, "Generate specific datatypes for swagger enums").defaultValue(Boolean.TRUE.toString()));
cliOptions.add(CliOption.newBoolean(PROP_GENERATE_FORM_URLENCODED_INSTANCES, "Generate FromForm/ToForm instances for models that are used by operations that produce or consume application/x-www-form-urlencoded").defaultValue(Boolean.TRUE.toString())); cliOptions.add(CliOption.newBoolean(PROP_GENERATE_FORM_URLENCODED_INSTANCES, "Generate FromForm/ToForm instances for models that are used by operations that produce or consume application/x-www-form-urlencoded").defaultValue(Boolean.TRUE.toString()));
cliOptions.add(CliOption.newBoolean(PROP_INLINE_CONSUMES_CONTENT_TYPES, "Inline (hardcode) the content-type on operations that do not have multiple content-types (Consumes)").defaultValue(Boolean.FALSE.toString())); cliOptions.add(CliOption.newBoolean(PROP_INLINE_CONSUMES_CONTENT_TYPES, "Inline (hardcode) the content-type on operations that do not have multiple content-types (Consumes)").defaultValue(Boolean.FALSE.toString()));
@ -237,7 +242,10 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
public void setGenerateModelConstructors(Boolean value) { public void setGenerateModelConstructors(Boolean value) {
additionalProperties.put(PROP_GENERATE_MODEL_CONSTRUCTORS, value); additionalProperties.put(PROP_GENERATE_MODEL_CONSTRUCTORS, value);
} }
public void setGenerateEnums(Boolean value) {
additionalProperties.put(PROP_GENERATE_ENUMS, value);
genEnums = value;
}
public void setGenerateFormUrlEncodedInstances(Boolean value) { public void setGenerateFormUrlEncodedInstances(Boolean value) {
additionalProperties.put(PROP_GENERATE_FORM_URLENCODED_INSTANCES, value); additionalProperties.put(PROP_GENERATE_FORM_URLENCODED_INSTANCES, value);
} }
@ -311,6 +319,12 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
setGenerateModelConstructors(true); setGenerateModelConstructors(true);
} }
if (additionalProperties.containsKey(PROP_GENERATE_ENUMS)) {
setGenerateEnums(convertPropertyToBoolean(PROP_GENERATE_ENUMS));
} else {
setGenerateEnums(true);
}
if (additionalProperties.containsKey(PROP_GENERATE_FORM_URLENCODED_INSTANCES)) { if (additionalProperties.containsKey(PROP_GENERATE_FORM_URLENCODED_INSTANCES)) {
setGenerateFormUrlEncodedInstances(convertPropertyToBoolean(PROP_GENERATE_FORM_URLENCODED_INSTANCES)); setGenerateFormUrlEncodedInstances(convertPropertyToBoolean(PROP_GENERATE_FORM_URLENCODED_INSTANCES));
} else { } else {
@ -515,7 +529,19 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
op.vendorExtensions.put(X_HAS_OPTIONAL_PARAMS, true); op.vendorExtensions.put(X_HAS_OPTIONAL_PARAMS, true);
} }
deduplicateParameter(param); if (typeMapping.containsKey(param.dataType)
|| param.isMapContainer || param.isListContainer
|| param.isPrimitiveType || param.isFile || param.isEnum) {
String dataType = genEnums && param.isEnum ? param.datatypeWithEnum : param.dataType;
String paramNameType = toDedupedName(toTypeName("Param", param.paramName), dataType, !param.isEnum);
param.vendorExtensions.put(X_PARAM_NAME_TYPE, paramNameType);
HashMap<String, Object> props = new HashMap<>();
props.put(X_IS_BODY_PARAM, param.isBodyParam);
addToUniques(X_NEWTYPE, paramNameType, dataType, props);
}
} }
processPathExpr(op); processPathExpr(op);
@ -560,14 +586,14 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
}); });
additionalProperties.put(X_UNKNOWN_MIME_TYPES, unknownMimeTypes); additionalProperties.put(X_UNKNOWN_MIME_TYPES, unknownMimeTypes);
ArrayList<CodegenParameter> params = new ArrayList<>(uniqueParamsByName.values()); ArrayList<Map<String,Object>> params = new ArrayList<>(uniqueParamNameTypes.values());
Collections.sort(params, new Comparator<CodegenParameter>() { Collections.sort(params, new Comparator<Map<String,Object>>() {
@Override @Override
public int compare(CodegenParameter o1, CodegenParameter o2) { public int compare(Map<String,Object> o1, Map<String,Object> o2) {
return return
((String) o1.vendorExtensions.get(X_PARAM_NAME_TYPE)) ((String) o1.get(X_PARAM_NAME_TYPE))
.compareTo( .compareTo(
(String) o2.vendorExtensions.get(X_PARAM_NAME_TYPE)); (String) o2.get(X_PARAM_NAME_TYPE));
} }
}); });
additionalProperties.put(X_ALL_UNIQUE_PARAMS, params); additionalProperties.put(X_ALL_UNIQUE_PARAMS, params);
@ -615,12 +641,6 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
prop.name = toVarName(prefix, prop.name); prop.name = toVarName(prefix, prop.name);
} }
//String dataOrNewtype = "data";
// check if it's a ModelImpl before casting
if (!(mod instanceof ModelImpl)) {
return model;
}
return model; return model;
} }
@ -699,51 +719,67 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
} }
} }
private void deduplicateParameter(CodegenParameter param) { private String toDedupedName(String paramNameType, String dataType, Boolean appendDataType) {
if (typeMapping.containsKey(param.dataType) || param.isPrimitiveType || param.isListContainer || param.isMapContainer || param.isFile) { if (appendDataType
&& uniqueParamNameTypes.containsKey(paramNameType)
String paramNameType = toTypeName("Param", param.paramName); && !isDuplicate(paramNameType, dataType)) {
paramNameType = paramNameType + dataType;
if (uniqueParamsByName.containsKey(paramNameType)) {
if(!checkParamForDuplicates(paramNameType, param)) {
paramNameType = paramNameType + param.dataType;
if(!checkParamForDuplicates(paramNameType, param)) {
while (typeNames.contains(paramNameType)) {
paramNameType = generateNextName(paramNameType);
if(checkParamForDuplicates(paramNameType, param)) {
break;
} }
}
}
uniqueParamsByName.put(paramNameType, param);
}
} else {
while (typeNames.contains(paramNameType)) { while (typeNames.contains(paramNameType)) {
paramNameType = generateNextName(paramNameType); if (isDuplicate(paramNameType, dataType)) {
if(checkParamForDuplicates(paramNameType, param)) {
break; break;
} }
paramNameType = generateNextName(paramNameType);
} }
uniqueParamsByName.put(paramNameType, param);
}
param.vendorExtensions.put(X_PARAM_NAME_TYPE, paramNameType);
typeNames.add(paramNameType); typeNames.add(paramNameType);
} return paramNameType;
} }
public Boolean checkParamForDuplicates(String paramNameType, CodegenParameter param) { public Boolean isDuplicate(String paramNameType, String dataType) {
CodegenParameter lastParam = this.uniqueParamsByName.get(paramNameType); Map<String, Object> lastParam = this.uniqueParamNameTypes.get(paramNameType);
if (lastParam != null && lastParam.dataType != null && lastParam.dataType.equals(param.dataType)) { if (lastParam != null) {
param.vendorExtensions.put(X_DUPLICATE, true); String comparisonKey = lastParam.containsKey(X_ENUM) ? X_ENUM_VALUES : X_DATA_TYPE;
String lastParamDataType = (String) lastParam.get(comparisonKey);
if (lastParamDataType != null && lastParamDataType.equals(dataType)) {
return true; return true;
} }
}
return false; return false;
} }
private Pair<Boolean, String> isDuplicateEnumValues(String enumValues) {
for (Map<String, Object> vs : uniqueParamNameTypes.values()) {
if (enumValues.equals(vs.get(X_ENUM_VALUES))) {
return Pair.of(true, (String) vs.get(X_PARAM_NAME_TYPE));
}
}
return Pair.of(false, null);
}
private void addToUniques(String xGroup, String paramNameType, String dataType, Map<String, Object> props) {
HashMap<String, Object> m = new HashMap<>();
m.put(X_PARAM_NAME_TYPE, paramNameType);
m.put(X_DATA_TYPE, dataType);
m.put(xGroup, true);
m.putAll(props);
uniqueParamNameTypes.put(paramNameType, m);
}
private void addEnumToUniques(String paramNameType, String datatype, String enumValues, Map<String, Object> allowableValues, String description) {
HashMap<String, Object> props = new HashMap<>();
props.put("allowableValues", allowableValues);
if(StringUtils.isNotBlank(description)) {
props.put("description", description);
}
props.put(X_ENUM_VALUES, enumValues);
addToUniques(X_ENUM, paramNameType, datatype, props);
additionalProperties.put(X_HAS_ENUM_SECTION, true);
}
// build the parameterized path segments, according to pathParams // build the parameterized path segments, according to pathParams
private void processPathExpr(CodegenOperation op) { private void processPathExpr(CodegenOperation op) {
String xPath = "[\"" + escapeText(op.path) + "\"]"; String xPath = "[\"" + escapeText(op.path) + "\"]";
@ -962,20 +998,121 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
} }
@Override @Override
public String toEnumName(CodegenProperty property) { public Map<String, Object> postProcessModels(Map<String, Object> objs) {
return "Enum'" + toTypeName("", property.name); 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");
cm.isEnum = genEnums && cm.isEnum;
if(cm.isAlias) {
cm.vendorExtensions.put(X_DATA_TYPE, cm.dataType);
}
for (CodegenProperty var : cm.vars) {
String datatype = genEnums && !StringUtils.isBlank(var.datatypeWithEnum)
? var.datatypeWithEnum
: var.datatype;
var.vendorExtensions.put(X_DATA_TYPE, datatype);
}
}
return postProcessModelsEnum(objs);
}
@Override
public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
Map<String, Object> objsEnum = super.postProcessModelsEnum(objs);
if (genEnums) {
List<Object> models = (List<Object>) objsEnum.get("models");
for (Object _mo : models) {
Map<String, Object> mo = (Map<String, Object>) _mo;
CodegenModel cm = (CodegenModel) mo.get("model");
if (cm.isEnum && cm.allowableValues != null) {
updateAllowableValuesNames(cm.classname, cm.allowableValues);
addEnumToUniques(cm.classname, cm.dataType, cm.allowableValues.values().toString(), cm.allowableValues, cm.description);
}
}
}
return objsEnum;
}
@Override
protected void updateDataTypeWithEnumForMap(CodegenProperty property) {
CodegenProperty baseItem = property.items;
while (baseItem != null && (Boolean.TRUE.equals(baseItem.isMapContainer) || Boolean.TRUE.equals(baseItem.isListContainer))) {
baseItem = baseItem.items;
}
if (baseItem != null) {
// this replacement is/needs to be language-specific
property.datatypeWithEnum = property.datatypeWithEnum.replace(baseItem.baseType + ")", toEnumName(baseItem) + ")");
property.enumName = toEnumName(property);
if (property.defaultValue != null) {
property.defaultValue = property.defaultValue.replace(", " + property.items.baseType, ", " + toEnumName(property.items));
}
}
}
@Override
public String toEnumName(CodegenProperty var) {
if (!genEnums) return super.toEnumName(var);
if (var.items != null && var.items.isEnum) {
return toEnumName(var.items);
}
String paramNameType = "E'" + toTypeName("", var.name);
String enumValues = var._enum.toString();
Pair<Boolean, String> duplicateEnum = isDuplicateEnumValues(enumValues);
if (duplicateEnum.getLeft()) {
paramNameType = duplicateEnum.getRight();
} else {
paramNameType = toDedupedName(paramNameType, enumValues, false);
var.datatypeWithEnum = paramNameType;
updateCodegenPropertyEnum(var);
addEnumToUniques(paramNameType, var.datatype, enumValues, var.allowableValues, var.description);
}
return paramNameType;
}
@Override
public void updateCodegenPropertyEnum(CodegenProperty var) {
super.updateCodegenPropertyEnum(var);
if (!genEnums) return;
updateCodegenPropertyEnumValues(var, var.datatypeWithEnum);
}
public void updateCodegenPropertyEnumValues(CodegenProperty var, String paramNameType) {
if (var.items != null && var.items.allowableValues != null) {
updateCodegenPropertyEnumValues(var.items, var.items.datatypeWithEnum);
return;
}
if(var.isEnum && var.allowableValues != null) {
updateAllowableValuesNames(paramNameType, var.allowableValues);
}
}
private void updateAllowableValuesNames(String paramNameType, Map<String, Object> allowableValues) {
if (allowableValues == null) {
return;
}
for (Map<String, String> enumVar : (List<Map<String, String>>) allowableValues.get("enumVars")) {
enumVar.put("name", paramNameType + enumVar.get("name"));
}
} }
@Override @Override
public String toEnumVarName(String value, String datatype) { public String toEnumVarName(String value, String datatype) {
if (!genEnums) return super.toEnumVarName(value, datatype);
List<String> num = new ArrayList<>(Arrays.asList("integer","int","double","long","float")); List<String> num = new ArrayList<>(Arrays.asList("integer","int","double","long","float"));
if (value.length() == 0) { if (value.length() == 0) {
return "E'Empty"; return "'Empty";
} }
// for symbol, e.g. $, # // for symbol, e.g. $, #
if (getSymbolName(value) != null) { if (getSymbolName(value) != null) {
return "E'" + sanitizeName(getSymbolName(value)); return "'" + StringUtils.capitalize(sanitizeName(getSymbolName(value)));
} }
// number // number
@ -984,10 +1121,10 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
varName = varName.replaceAll("-", "Minus_"); varName = varName.replaceAll("-", "Minus_");
varName = varName.replaceAll("\\+", "Plus_"); varName = varName.replaceAll("\\+", "Plus_");
varName = varName.replaceAll("\\.", "_Dot_"); varName = varName.replaceAll("\\.", "_Dot_");
return "E'" + sanitizeName(varName); return "'" + StringUtils.capitalize(sanitizeName(varName));
} }
return "E'" + sanitizeName(value); return "'" + StringUtils.capitalize(sanitizeName(value));
} }
@Override @Override

View File

@ -1,10 +1,13 @@
package io.swagger.codegen.languages; package io.swagger.codegen.languages;
import static java.util.Collections.sort;
import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.LinkedListMultimap;
import io.swagger.codegen.*; import io.swagger.codegen.*;
import io.swagger.codegen.languages.features.BeanValidationFeatures; import io.swagger.codegen.languages.features.BeanValidationFeatures;
import io.swagger.codegen.languages.features.GzipFeatures; import io.swagger.codegen.languages.features.GzipFeatures;
import io.swagger.codegen.languages.features.PerformBeanValidationFeatures; import io.swagger.codegen.languages.features.PerformBeanValidationFeatures;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -49,6 +52,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
protected boolean useGzipFeature = false; protected boolean useGzipFeature = false;
protected boolean useRuntimeException = false; protected boolean useRuntimeException = false;
public JavaClientCodegen() { public JavaClientCodegen() {
super(); super();
outputFolder = "generated-code" + File.separator + "java"; outputFolder = "generated-code" + File.separator + "java";
@ -316,10 +320,34 @@ public class JavaClientCodegen extends AbstractJavaCodegen
if (operation.returnType == null) { if (operation.returnType == null) {
operation.returnType = "Void"; operation.returnType = "Void";
} }
if (usesRetrofit2Library() && StringUtils.isNotEmpty(operation.path) && operation.path.startsWith("/")) if (usesRetrofit2Library() && StringUtils.isNotEmpty(operation.path) && operation.path.startsWith("/")){
operation.path = operation.path.substring(1); operation.path = operation.path.substring(1);
} }
// sorting operation parameters to make sure path params are parsed before query params
if (operation.allParams != null) {
sort(operation.allParams, new Comparator<CodegenParameter>() {
@Override
public int compare(CodegenParameter one, CodegenParameter another) {
if (one.isPathParam && another.isQueryParam) {
return -1;
} }
if (one.isQueryParam && another.isPathParam){
return 1;
}
return 0;
}
});
Iterator<CodegenParameter> iterator = operation.allParams.iterator();
while (iterator.hasNext()){
CodegenParameter param = iterator.next();
param.hasMore = iterator.hasNext();
}
}
}
}
} }
// camelize path variables for Feign client // camelize path variables for Feign client

View File

@ -246,8 +246,6 @@ public class SpringCodegen extends AbstractJavaCodegen
additionalProperties.put(SINGLE_CONTENT_TYPES, "true"); additionalProperties.put(SINGLE_CONTENT_TYPES, "true");
this.setSingleContentTypes(true); this.setSingleContentTypes(true);
} }
additionalProperties.put("useSpringCloudClient", true);
} else { } else {
apiTemplateFiles.put("apiController.mustache", "Controller.java"); apiTemplateFiles.put("apiController.mustache", "Controller.java");
supportingFiles.add(new SupportingFile("apiException.mustache", supportingFiles.add(new SupportingFile("apiException.mustache",

View File

@ -1 +1 @@
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} {{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@ -17,6 +17,17 @@
play.filters.headers.contentSecurityPolicy=null play.filters.headers.contentSecurityPolicy=null
{{#useBeanValidation}}
# When using bean validation with the swagger api, the validator will check that every constraint is respected
# This is very useful when testing but could add a lot of overhead if you return a lot of data. Benchmark have
# shown that the time it takes to validate is exponential.
# If this is a concern in your application, or if you don't want to validate the output coming from your API for
# respecting its contract, set the "output" property below to "false". Since there is not a lot of data as input for
# an endpoint, I highly suggest you let the "input" property set to true.
useInputBeanValidation=true
useOutputBeanValidation=true
{{/useBeanValidation}}
{{#handleExceptions}} {{#handleExceptions}}
play.http.errorHandler="swagger.ErrorHandler" play.http.errorHandler="swagger.ErrorHandler"
{{/handleExceptions}} {{/handleExceptions}}

View File

@ -1 +1 @@
{{#isBoolean}}Boolean.valueOf({{/isBoolean}}{{#isInteger}}Integer.parseInt({{/isInteger}}{{#isDouble}}Double.parseDouble({{/isDouble}}{{#isLong}}Long.parseLong({{/isLong}}{{#isFloat}}Float.parseFloat({{/isFloat}}{{#isUuid}}UUID.fromString({{/isUuid}}{{#isDateTime}}OffsetDateTime.parse({{/isDateTime}} {{#isBoolean}}Boolean.valueOf({{/isBoolean}}{{#isInteger}}Integer.parseInt({{/isInteger}}{{#isDouble}}Double.parseDouble({{/isDouble}}{{#isLong}}Long.parseLong({{/isLong}}{{#isFloat}}Float.parseFloat({{/isFloat}}{{#isUuid}}UUID.fromString({{/isUuid}}{{#isDateTime}}OffsetDateTime.parse({{/isDateTime}}{{#isDate}}LocalDate.parse({{/isDate}}{{#isByteArray}}{{/isByteArray}}

View File

@ -1 +1 @@
{{#isBoolean}}){{/isBoolean}}{{#isInteger}}){{/isInteger}}{{#isDouble}}){{/isDouble}}{{#isLong}}){{/isLong}}{{#isFloat}}){{/isFloat}}{{#isUuid}}){{/isUuid}}{{#isDateTime}}){{/isDateTime}} {{#isBoolean}}){{/isBoolean}}{{#isInteger}}){{/isInteger}}{{#isDouble}}){{/isDouble}}{{#isLong}}){{/isLong}}{{#isFloat}}){{/isFloat}}{{#isUuid}}){{/isUuid}}{{#isDateTime}}){{/isDateTime}}{{#isDate}}){{/isDate}}{{#isByteArray}}.getBytes(){{/isByteArray}}

View File

@ -1 +1 @@
{{#items.isBoolean}}Boolean.valueOf({{/items.isBoolean}}{{#items.isInteger}}Integer.parseInt({{/items.isInteger}}{{#items.isDouble}}Double.parseDouble({{/items.isDouble}}{{#items.isLong}}Long.parseLong({{/items.isLong}}{{#items.isFloat}}Float.parseFloat({{/items.isFloat}}{{#items.isUuid}}UUID.fromString({{/items.isUuid}}{{#items.isDateTime}}OffsetDateTime.parse({{/items.isDateTime}} {{#items.isBoolean}}Boolean.valueOf({{/items.isBoolean}}{{#items.isInteger}}Integer.parseInt({{/items.isInteger}}{{#items.isDouble}}Double.parseDouble({{/items.isDouble}}{{#items.isLong}}Long.parseLong({{/items.isLong}}{{#items.isFloat}}Float.parseFloat({{/items.isFloat}}{{#items.isUuid}}UUID.fromString({{/items.isUuid}}{{#items.isDateTime}}OffsetDateTime.parse({{/items.isDateTime}}{{#items.isDate}}LocalDate.parse({{/items.isDate}}{{#isByteArray}}{{/isByteArray}}

View File

@ -1 +1 @@
{{#items.isBoolean}}){{/items.isBoolean}}{{#items.isInteger}}){{/items.isInteger}}{{#items.isDouble}}){{/items.isDouble}}{{#items.isLong}}){{/items.isLong}}{{#items.isFloat}}){{/items.isFloat}}{{#items.isUuid}}){{/items.isUuid}}{{#items.isDateTime}}){{/items.isDateTime}} {{#items.isBoolean}}){{/items.isBoolean}}{{#items.isInteger}}){{/items.isInteger}}{{#items.isDouble}}){{/items.isDouble}}{{#items.isLong}}){{/items.isLong}}{{#items.isFloat}}){{/items.isFloat}}{{#items.isUuid}}){{/items.isUuid}}{{#items.isDateTime}}){{/items.isDateTime}}{{#items.isDate}}){{/items.isDate}}{{#isByteArray}}.getBytes(){{/isByteArray}}

View File

@ -21,6 +21,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
{{#useBeanValidation}} {{#useBeanValidation}}
import javax.validation.constraints.*; import javax.validation.constraints.*;
import play.Configuration;
{{/useBeanValidation}} {{/useBeanValidation}}
{{#wrapCalls}} {{#wrapCalls}}
@ -35,13 +36,19 @@ public class {{classname}}Controller extends Controller {
private final {{classname}}ControllerImp{{#useInterfaces}}Interface{{/useInterfaces}} imp; private final {{classname}}ControllerImp{{#useInterfaces}}Interface{{/useInterfaces}} imp;
{{/controllerOnly}} {{/controllerOnly}}
private final ObjectMapper mapper; private final ObjectMapper mapper;
{{#useBeanValidation}}
private final Configuration configuration;
{{/useBeanValidation}}
@Inject @Inject
private {{classname}}Controller({{^controllerOnly}}{{classname}}ControllerImp{{#useInterfaces}}Interface{{/useInterfaces}} imp{{/controllerOnly}}) { private {{classname}}Controller({{#useBeanValidation}}Configuration configuration{{^controllerOnly}}, {{/controllerOnly}}{{/useBeanValidation}}{{^controllerOnly}}{{classname}}ControllerImp{{#useInterfaces}}Interface{{/useInterfaces}} imp{{/controllerOnly}}) {
{{^controllerOnly}} {{^controllerOnly}}
this.imp = imp; this.imp = imp;
{{/controllerOnly}} {{/controllerOnly}}
mapper = new ObjectMapper(); mapper = new ObjectMapper();
{{#useBeanValidation}}
this.configuration = configuration;
{{/useBeanValidation}}
} }
{{#operation}} {{#operation}}
@ -55,12 +62,21 @@ public class {{classname}}Controller extends Controller {
if (node{{paramName}} != null) { if (node{{paramName}} != null) {
{{paramName}} = mapper.readValue(node{{paramName}}.toString(), {{#isContainer}}new TypeReference<{{{dataType}}}>(){}{{/isContainer}}{{^isContainer}}{{{dataType}}}.class{{/isContainer}}); {{paramName}} = mapper.readValue(node{{paramName}}.toString(), {{#isContainer}}new TypeReference<{{{dataType}}}>(){}{{/isContainer}}{{^isContainer}}{{{dataType}}}.class{{/isContainer}});
{{#useBeanValidation}} {{#useBeanValidation}}
{{#isListContainer}}for ({{{baseType}}} curItem : {{paramName}}) { if (configuration.getBoolean("useInputBeanValidation")) {
curItem.validate(); {{#isListContainer}}
}{{/isListContainer}}{{#isMapContainer}}for (Map.Entry<String, {{{baseType}}}> entry : {{paramName}}.entrySet()) { for ({{{baseType}}} curItem : {{paramName}}) {
entry.getValue().validate(); SwaggerUtils.validate(curItem);
}
{{/isListContainer}}
{{#isMapContainer}}
for (Map.Entry<String, {{{baseType}}}> entry : {{paramName}}.entrySet()) {
SwaggerUtils.validate(entry.getValue());
}
{{/isMapContainer}}
{{^isContainer}}
SwaggerUtils.validate({{paramName}});
{{/isContainer}}
} }
{{/isMapContainer}}{{^isContainer}}{{paramName}}.validate();{{/isContainer}}
{{/useBeanValidation}} {{/useBeanValidation}}
} else { } else {
{{#required}} {{#required}}
@ -173,13 +189,30 @@ public class {{classname}}Controller extends Controller {
{{/collectionFormat}} {{/collectionFormat}}
{{/headerParams}} {{/headerParams}}
{{^controllerOnly}} {{^controllerOnly}}
{{#returnType}}{{>returnTypesNoVoid}} obj = {{/returnType}}imp.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}{{^isResponseFile}}{{^returnTypeIsPrimitive}}{{#useBeanValidation}} {{#returnType}}{{>returnTypesNoVoid}} obj = {{/returnType}}imp.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{#isListContainer}}for ({{{returnType}}} curItem : obj) { {{#returnType}}
curItem.validate(); {{^isResponseFile}}
}{{/isListContainer}}{{#isMapContainer}}for (Map.Entry<String, {{{returnType}}}> entry : obj.entrySet()) { {{^returnTypeIsPrimitive}}
entry.getValue().validate(); {{#useBeanValidation}}
if (configuration.getBoolean("useOutputBeanValidation")) {
{{#isListContainer}}
for ({{{returnType}}} curItem : obj) {
SwaggerUtils.validate(curItem);
} }
{{/isMapContainer}}{{^returnContainer}}obj.validate();{{/returnContainer}}{{/useBeanValidation}}{{/returnTypeIsPrimitive}}{{/isResponseFile}}{{/returnType}} {{/isListContainer}}
{{#isMapContainer}}
for (Map.Entry<String, {{{returnType}}}> entry : obj.entrySet()) {
SwaggerUtils.validate(entry.getValue());
}
{{/isMapContainer}}
{{^returnContainer}}
SwaggerUtils.validate(obj);
{{/returnContainer}}
}
{{/useBeanValidation}}
{{/returnTypeIsPrimitive}}
{{/isResponseFile}}
{{/returnType}}
{{#returnType}} {{#returnType}}
{{^isResponseFile}}JsonNode result = mapper.valueToTree(obj); {{^isResponseFile}}JsonNode result = mapper.valueToTree(obj);
return ok(result); return ok(result);

View File

@ -134,22 +134,4 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
} }
return o.toString().replace("\n", "\n "); return o.toString().replace("\n", "\n ");
} }
{{#useBeanValidation}}
public void validate() {
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<{{classname}}>> constraintViolations = validator.validate(this);
if (constraintViolations.size() > 0) {
StringBuilder errors = new StringBuilder();
for (ConstraintViolation<{{classname}}> contraintes : constraintViolations) {
errors.append(String.format("%s.%s %s\n",
contraintes.getRootBeanClass().getSimpleName(),
contraintes.getPropertyPath(),
contraintes.getMessage()));
}
throw new RuntimeException("Bean validation : " + errors);
}
}
{{/useBeanValidation}}
} }

View File

@ -9,6 +9,13 @@ import java.lang.annotation.Target;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
{{#useBeanValidation}}
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
{{/useBeanValidation}}
public class SwaggerUtils { public class SwaggerUtils {
{{#wrapCalls}} {{#wrapCalls}}
@ -19,6 +26,24 @@ public class SwaggerUtils {
} }
{{/wrapCalls}} {{/wrapCalls}}
{{#useBeanValidation}}
public static <T> void validate(T obj) {
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<T>> constraintViolations = validator.validate(obj);
if (constraintViolations.size() > 0) {
StringBuilder errors = new StringBuilder();
for (ConstraintViolation<T> contraintes : constraintViolations) {
errors.append(String.format("%s.%s %s\n",
contraintes.getRootBeanClass().getSimpleName(),
contraintes.getPropertyPath(),
contraintes.getMessage()));
}
throw new RuntimeException("Bean validation : " + errors);
}
}
{{/useBeanValidation}}
public static List<String> parametersToList(String collectionFormat, String[] values){ public static List<String> parametersToList(String collectionFormat, String[] values){
List<String> params = new ArrayList<>(); List<String> params = new ArrayList<>();

View File

@ -7,12 +7,19 @@ package {{package}};
{{#imports}}import {{import}}; {{#imports}}import {{import}};
{{/imports}} {{/imports}}
{{#jdk8-no-delegate}}
import com.fasterxml.jackson.databind.ObjectMapper;
{{/jdk8-no-delegate}}
import io.swagger.annotations.*; import io.swagger.annotations.*;
{{#jdk8}} {{#jdk8-no-delegate}}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
{{/jdk8}} {{/jdk8-no-delegate}}
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
{{#useBeanValidation}}
import org.springframework.validation.annotation.Validated;
{{/useBeanValidation}}
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
@ -21,26 +28,54 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
{{^useSpringCloudClient}}
import java.io.IOException;
{{/useSpringCloudClient}}
{{#jdk8-no-delegate}}
import javax.servlet.http.HttpServletRequest;
{{/jdk8-no-delegate}}
{{#useBeanValidation}}
import javax.validation.Valid;
import javax.validation.constraints.*;
{{/useBeanValidation}}
{{#jdk8-no-delegate}}
import java.io.IOException;
{{/jdk8-no-delegate}}
import java.util.List; import java.util.List;
{{#useOptional}} {{#jdk8-no-delegate}}
import java.util.Optional; import java.util.Optional;
{{/useOptional}} {{/jdk8-no-delegate}}
{{^jdk8-no-delegate}}
{{#useOptional}}
import java.util.Optional;
{{/useOptional}}
{{/jdk8-no-delegate}}
{{#async}} {{#async}}
import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}}; import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}};
{{/async}} {{/async}}
{{#useBeanValidation}}
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.*;
import javax.validation.Valid;
{{/useBeanValidation}}
{{>generatedAnnotation}} {{>generatedAnnotation}}
@Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API") @Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API")
{{#operations}} {{#operations}}
public interface {{classname}} { public interface {{classname}} {
{{#jdk8}}
{{^isDelegate}}
Logger log = LoggerFactory.getLogger({{classname}}.class);
default Optional<ObjectMapper> getObjectMapper() {
return Optional.empty();
}
default Optional<HttpServletRequest> getRequest() {
return Optional.empty();
}
default Optional<String> getAcceptHeader() {
return getRequest().map(r -> r.getHeader("Accept"));
}
{{/isDelegate}}
{{#isDelegate}}
{{classname}}Delegate getDelegate();
{{/isDelegate}}
{{/jdk8}}
{{#operation}} {{#operation}}
@ApiOperation(value = "{{{summary}}}", nickname = "{{{operationId}}}", notes = "{{{notes}}}"{{#returnBaseType}}, response = {{{returnBaseType}}}.class{{/returnBaseType}}{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { @ApiOperation(value = "{{{summary}}}", nickname = "{{{operationId}}}", notes = "{{{notes}}}"{{#returnBaseType}}, response = {{{returnBaseType}}}.class{{/returnBaseType}}{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
@ -65,20 +100,29 @@ public interface {{classname}} {
produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}} produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}}
consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}} consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}}
method = RequestMethod.{{httpMethod}}) method = RequestMethod.{{httpMethod}})
{{#useSpringCloudClient}}
{{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} { {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} {
// do some magic! {{^isDelegate}}
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.NOT_IMPLEMENTED){{#async}}){{/async}}; if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
{{#examples}}
if (getAcceptHeader().get().contains("{{{contentType}}}")) {
try {
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<>(getObjectMapper().get().readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.NOT_IMPLEMENTED){{#async}}){{/async}};
} catch (IOException e) {
log.error("Couldn't serialize response for content type {{{contentType}}}", e);
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR){{#async}}){{/async}};
}
}
{{/examples}}
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default {{classname}} interface so no example is generated");
}
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED){{#async}}){{/async}};
{{/isDelegate}}
{{#isDelegate}}
return getDelegate().{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/isDelegate}}
}{{/jdk8}} }{{/jdk8}}
{{/useSpringCloudClient}}
{{^useSpringCloudClient}}
{{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}} @RequestHeader(value = "Accept", required = false) String accept) throws Exception{{^jdk8}};{{/jdk8}}{{#jdk8}} {
// do some magic!
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}};
}{{/jdk8}}
{{/useSpringCloudClient}}
{{/operation}} {{/operation}}
} }
{{/operations}} {{/operations}}

View File

@ -1,16 +1,21 @@
package {{package}}; package {{package}};
{{^jdk8-no-delegate}} {{^jdk8}}
{{#imports}}import {{import}}; {{#imports}}import {{import}};
{{/imports}} {{/imports}}
{{/jdk8}}
{{^isDelegate}}
import com.fasterxml.jackson.databind.ObjectMapper;
{{/isDelegate}}
{{^jdk8}}
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
{{/jdk8-no-delegate}} {{/jdk8}}
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
{{^jdk8-no-delegate}} {{^jdk8}}
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
@ -18,31 +23,35 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List; {{#useBeanValidation}}
{{#useOptional}}
import java.util.Optional;
{{/useOptional}}
{{#async}}
import java.util.concurrent.Callable;
{{/async}}
{{/jdk8-no-delegate}}
{{^useSpringCloudClient}}
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
{{/useSpringCloudClient}}
{{#useBeanValidation}}
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid; import javax.validation.Valid;
{{/useBeanValidation}} {{/useBeanValidation}}
{{/jdk8}}
{{^isDelegate}}
import javax.servlet.http.HttpServletRequest;
{{#jdk8}}
import java.util.Optional;
{{/jdk8}}
{{/isDelegate}}
{{^jdk8-no-delegate}}
{{#useOptional}}
import java.util.Optional;
{{/useOptional}}
{{/jdk8-no-delegate}}
{{^jdk8}}
{{^isDelegate}}
import java.io.IOException;
{{/isDelegate}}
import java.util.List;
{{#async}}
import java.util.concurrent.Callable;
{{/async}}
{{/jdk8}}
{{>generatedAnnotation}} {{>generatedAnnotation}}
@Controller @Controller
{{#operations}} {{#operations}}
public class {{classname}}Controller implements {{classname}} { public class {{classname}}Controller implements {{classname}} {
private final ObjectMapper objectMapper;
public {{classname}}Controller(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
{{#isDelegate}} {{#isDelegate}}
private final {{classname}}Delegate delegate; private final {{classname}}Delegate delegate;
@ -51,48 +60,78 @@ public class {{classname}}Controller implements {{classname}} {
public {{classname}}Controller({{classname}}Delegate delegate) { public {{classname}}Controller({{classname}}Delegate delegate) {
this.delegate = delegate; this.delegate = delegate;
} }
{{#jdk8}}
@Override
public {{classname}}Delegate getDelegate() {
return delegate;
}
{{/jdk8}}
{{/isDelegate}}
{{^isDelegate}}
{{^jdk8}}
private static final Logger log = LoggerFactory.getLogger({{classname}}Controller.class);
{{/jdk8}}
private final ObjectMapper objectMapper;
private final HttpServletRequest request;
@org.springframework.beans.factory.annotation.Autowired
public {{classname}}Controller(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}
{{#jdk8}}
@Override
public Optional<ObjectMapper> getObjectMapper() {
return Optional.ofNullable(objectMapper);
}
@Override
public Optional<HttpServletRequest> getRequest() {
return Optional.ofNullable(request);
}
{{/jdk8}}
{{/isDelegate}} {{/isDelegate}}
{{^jdk8-no-delegate}} {{^jdk8}}
{{#operation}} {{#operation}}
public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}, public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) {
{{/allParams}}@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
{{#useSpringCloudClient}}
{{^isDelegate}}
{{^async}}
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
{{/async}}
{{#async}}
return new Callable<ResponseEntity<{{>returnTypes}}>>() {
@Override
public ResponseEntity<{{>returnTypes}}> call() throws Exception {
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
}
};
{{/async}}
{{/isDelegate}}
{{#isDelegate}}
return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/isDelegate}}
{{/useSpringCloudClient}}
{{^useSpringCloudClient}}
{{^isDelegate}} {{^isDelegate}}
{{^async}} {{^async}}
String accept = request.getHeader("Accept");
{{#examples}} {{#examples}}
if (accept != null && accept.contains("{{{contentType}}}")) { if (accept != null && accept.contains("{{{contentType}}}")) {
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.OK); try {
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type {{{contentType}}}", e);
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.INTERNAL_SERVER_ERROR);
}
} }
{{/examples}} {{/examples}}
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); return new ResponseEntity<{{>returnTypes}}>(HttpStatus.NOT_IMPLEMENTED);
{{/async}} {{/async}}
{{#async}} {{#async}}
return new Callable<ResponseEntity<{{>returnTypes}}>>() { return new Callable<ResponseEntity<{{>returnTypes}}>>() {
@Override @Override
public ResponseEntity<{{>returnTypes}}> call() throws Exception { public ResponseEntity<{{>returnTypes}}> call() {
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); String accept = request.getHeader("Accept");
{{#examples}}
if (accept != null && accept.contains("{{{contentType}}}")) {
try {
return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type {{{contentType}}}", e);
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
{{/examples}}
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.NOT_IMPLEMENTED);
} }
}; };
{{/async}} {{/async}}
@ -100,10 +139,9 @@ public class {{classname}}Controller implements {{classname}} {
{{#isDelegate}} {{#isDelegate}}
return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/isDelegate}} {{/isDelegate}}
{{/useSpringCloudClient}}
} }
{{/operation}} {{/operation}}
{{/jdk8-no-delegate}} {{/jdk8}}
} }
{{/operations}} {{/operations}}

View File

@ -2,13 +2,33 @@ package {{package}};
{{#imports}}import {{import}}; {{#imports}}import {{import}};
{{/imports}} {{/imports}}
{{#jdk8}}
import io.swagger.annotations.*;{{#jdk8}} import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.HttpStatus;{{/jdk8}} {{/jdk8}}
import io.swagger.annotations.*;
{{#jdk8}}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
{{/jdk8}}
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
{{#jdk8}}
import java.io.IOException;
{{/jdk8}}
{{#jdk8}}
import javax.servlet.http.HttpServletRequest;
{{/jdk8}}
import java.util.List; import java.util.List;
{{#jdk8}}
import java.util.Optional;
{{/jdk8}}
{{^jdk8}}
{{#useOptional}}
import java.util.Optional;
{{/useOptional}}
{{/jdk8}}
{{#async}} {{#async}}
import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}}; import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture{{/jdk8}};
{{/async}} {{/async}}
@ -16,11 +36,26 @@ import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture
{{#operations}} {{#operations}}
/** /**
* A delegate to be called by the {@link {{classname}}Controller}}. * A delegate to be called by the {@link {{classname}}Controller}}.
* Should be implemented as a controller but without the {@link org.springframework.stereotype.Controller} annotation. * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class.
* Instead, use spring to autowire this class into the {@link {{classname}}Controller}.
*/ */
{{>generatedAnnotation}} {{>generatedAnnotation}}
public interface {{classname}}Delegate { public interface {{classname}}Delegate {
{{#jdk8}}
Logger log = LoggerFactory.getLogger({{classname}}.class);
default Optional<ObjectMapper> getObjectMapper() {
return Optional.empty();
}
default Optional<HttpServletRequest> getRequest() {
return Optional.empty();
}
default Optional<String> getAcceptHeader() {
return getRequest().map(r -> r.getHeader("Accept"));
}
{{/jdk8}}
{{#operation}} {{#operation}}
/** /**
@ -28,8 +63,21 @@ public interface {{classname}}Delegate {
*/ */
{{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{^isFile}}{{{dataType}}}{{/isFile}}{{#isFile}}MultipartFile{{/isFile}} {{paramName}}{{#hasMore}}, {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{^isFile}}{{{dataType}}}{{/isFile}}{{#isFile}}MultipartFile{{/isFile}} {{paramName}}{{#hasMore}},
{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} { {{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} {
// do some magic! if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}}; {{#examples}}
if (getAcceptHeader().get().contains("{{{contentType}}}")) {
try {
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<>(getObjectMapper().get().readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.NOT_IMPLEMENTED){{#async}}){{/async}};
} catch (IOException e) {
log.error("Couldn't serialize response for content type {{{contentType}}}", e);
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR){{#async}}){{/async}};
}
}
{{/examples}}
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default {{classname}} interface so no example is generated");
}
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED){{#async}}){{/async}};
}{{/jdk8}} }{{/jdk8}}
{{/operation}} {{/operation}}

View File

@ -1,20 +1,20 @@
{{#pattern}} @Pattern(regexp="{{{pattern}}}"){{/pattern}}{{! {{#pattern}}@Pattern(regexp="{{{pattern}}}") {{/pattern}}{{!
minLength && maxLength set minLength && maxLength set
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{! }}{{#minLength}}{{#maxLength}}@Size(min={{minLength}},max={{maxLength}}) {{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not minLength set, maxLength not
}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{! }}{{#minLength}}{{^maxLength}}@Size(min={{minLength}}) {{/maxLength}}{{/minLength}}{{!
minLength not set, maxLength set minLength not set, maxLength set
}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{! }}{{^minLength}}{{#maxLength}}@Size(max={{maxLength}}) {{/maxLength}}{{/minLength}}{{!
@Size: minItems && maxItems set @Size: minItems && maxItems set
}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{! }}{{#minItems}}{{#maxItems}}@Size(min={{minItems}},max={{maxItems}}) {{/maxItems}}{{/minItems}}{{!
@Size: minItems set, maxItems not @Size: minItems set, maxItems not
}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{! }}{{#minItems}}{{^maxItems}}@Size(min={{minItems}}) {{/maxItems}}{{/minItems}}{{!
@Size: minItems not set && maxItems set @Size: minItems not set && maxItems set
}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{! }}{{^minItems}}{{#maxItems}}@Size(max={{maxItems}}) {{/maxItems}}{{/minItems}}{{!
check for integer or long / all others=decimal type with @Decimal* check for integer or long / all others=decimal type with @Decimal*
isInteger set isInteger set
}}{{#isInteger}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}{{/isInteger}}{{! }}{{#isInteger}}{{#minimum}}@Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}) {{/maximum}}{{/isInteger}}{{!
isLong set isLong set
}}{{#isLong}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}{{/isLong}}{{! }}{{#isLong}}{{#minimum}}@Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}) {{/maximum}}{{/isLong}}{{!
Not Integer, not Long => we have a decimal value! Not Integer, not Long => we have a decimal value!
}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}"){{/maximum}}{{/isLong}}{{/isInteger}} }}{{^isInteger}}{{^isLong}}{{#minimum}}@DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @DecimalMax("{{maximum}}") {{/maximum}}{{/isLong}}{{/isInteger}}

View File

@ -1 +1 @@
{{#required}} @NotNull{{/required}}{{>beanValidationCore}} {{#required}}@NotNull {{/required}}{{>beanValidationCore}}

View File

@ -15,8 +15,8 @@ mono nuget.exe install src/{{packageName}}/packages.config -o packages;
echo "[INFO] Copy DLLs to the 'bin' folder" echo "[INFO] Copy DLLs to the 'bin' folder"
mkdir -p bin; mkdir -p bin;
cp packages/Newtonsoft.Json.10.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/Newtonsoft.Json.{{#isNet40}}4.5.11{{/isNet40}}{{^isNet40}}10.0.3{{/isNet40}}/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
cp packages/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll; cp packages/RestSharp.105.1.0/lib/{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}/RestSharp.dll bin/RestSharp.dll;
{{#generatePropertyChanged}} {{#generatePropertyChanged}}
cp packages/Fody.1.29.4/Fody.dll bin/Fody.dll cp packages/Fody.1.29.4/Fody.dll bin/Fody.dll
cp packages/PropertyChanged.Fody.1.51.3/PropertyChanged.Fody.dll bin/PropertyChanged.Fody.dll cp packages/PropertyChanged.Fody.1.51.3/PropertyChanged.Fody.dll bin/PropertyChanged.Fody.dll

View File

@ -15,8 +15,8 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient
if not exist ".\bin" mkdir bin if not exist ".\bin" mkdir bin
copy packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll copy packages\Newtonsoft.Json.{{#isNet40}}4.5.11{{/isNet40}}{{^isNet40}}10.0.3{{/isNet40}}\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll
copy packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll bin\RestSharp.dll copy packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll bin\RestSharp.dll
{{#generatePropertyChanged}} {{#generatePropertyChanged}}
copy packages\Fody.1.29.4\Fody.dll bin\Fody.dll copy packages\Fody.1.29.4\Fody.dll bin\Fody.dll
copy packages\PropertyChanged.Fody.1.51.3\PropertyChanged.Fody.dll bin\PropertyChanged.Fody.dll copy packages\PropertyChanged.Fody.1.51.3\PropertyChanged.Fody.dll bin\PropertyChanged.Fody.dll

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" /> <package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" /> <package id="Newtonsoft.Json" version="{{#isNet40}}4.5.11{{/isNet40}}{{^isNet40}}10.0.3{{/isNet40}}" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
{{#generatePropertyChanged}} {{#generatePropertyChanged}}
<package id="Fody" version="1.29.4" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" /> <package id="Fody" version="1.29.4" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="PropertyChanged.Fody" version="1.51.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" /> <package id="PropertyChanged.Fody" version="1.51.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />

View File

@ -2,5 +2,5 @@
<packages> <packages>
<package id="NUnit" version="2.6.4" targetFramework="{{targetFrameworkNuget}}" /> <package id="NUnit" version="2.6.4" targetFramework="{{targetFrameworkNuget}}" />
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" /> <package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" /> <package id="Newtonsoft.Json" version="{{#isNet40}}4.5.11{{/isNet40}}{{^isNet40}}10.0.3{{/isNet40}}" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
</packages> </packages>

View File

@ -10,13 +10,13 @@ defmodule {{moduleName}}.RequestBuilder do
## Parameters ## Parameters
- request (Map) - Collected request options - request (Map) - Collected request options
- m (String) - Request method - m (atom) - Request method
## Returns ## Returns
Map Map
""" """
@spec method(map(), String.t) :: map() @spec method(map(), atom) :: map()
def method(request, m) do def method(request, m) do
Map.put_new(request, :method, m) Map.put_new(request, :method, m)
end end
@ -51,7 +51,7 @@ defmodule {{moduleName}}.RequestBuilder do
Map Map
""" """
@spec add_optional_params(map(), %{optional(:atom) => :atom}, keyword()) :: map() @spec add_optional_params(map(), %{optional(atom) => atom}, keyword()) :: map()
def add_optional_params(request, _, []), do: request def add_optional_params(request, _, []), do: request
def add_optional_params(request, definitions, [{key, value} | tail]) do def add_optional_params(request, definitions, [{key, value} | tail]) do
case definitions do case definitions do
@ -78,7 +78,7 @@ defmodule {{moduleName}}.RequestBuilder do
Map Map
""" """
@spec add_param(map(), :atom, :atom, any()) :: map() @spec add_param(map(), atom, atom, any()) :: map()
def add_param(request, :body, :body, value), do: Map.put(request, :body, value) def add_param(request, :body, :body, value), do: Map.put(request, :body, value)
def add_param(request, :body, key, value) do def add_param(request, :body, key, value) do
request request
@ -103,25 +103,20 @@ defmodule {{moduleName}}.RequestBuilder do
## Parameters ## Parameters
- env (Tesla.Env) - The response object - arg1 (Tesla.Env.t | term) - The response object
- struct - The shape of the struct to deserialize into - arg2 (:false | struct | [struct]) - The shape of the struct to deserialize into
## Returns ## Returns
{:ok, struct} on success {:ok, struct} on success
{:error, info} on failure {:error, term} on failure
""" """
@spec decode(Tesla.Env.t) :: {:ok, struct()} | {:error, Tesla.Env.t} @spec decode(Tesla.Env.t | term()) :: {:ok, struct()} | {:error, Tesla.Env.t} | {:error, term()}
def decode(%Tesla.Env{status: 200, body: body}), do: Poison.decode(body) def decode(%Tesla.Env{status: 200, body: body}), do: Poison.decode(body)
def decode(response) do def decode(response), do: {:error, response}
{:error, response}
end @spec decode(Tesla.Env.t | term(), :false | struct() | [struct()]) :: {:ok, struct()} | {:error, Tesla.Env.t} | {:error, term()}
@spec decode(Tesla.Env.t, struct()) :: {:ok, struct()} | {:error, Tesla.Env.t}
def decode(%Tesla.Env{status: 200} = env, false), do: {:ok, env} def decode(%Tesla.Env{status: 200} = env, false), do: {:ok, env}
def decode(%Tesla.Env{status: 200, body: body}, struct) do def decode(%Tesla.Env{status: 200, body: body}, struct), do: Poison.decode(body, as: struct)
Poison.decode(body, as: struct) def decode(response, _struct), do: {:error, response}
end
def decode(response, _struct) do
{:error, response}
end
end end

View File

@ -75,7 +75,7 @@ import qualified Prelude as P
{{operationId}} {{operationId}}
:: {{#vendorExtensions.x-hasBodyOrFormParam}}(Consumes {{{vendorExtensions.x-operationType}}} {{>_contentType}}{{#allParams}}{{#isBodyParam}}{{#required}}, MimeRender {{>_contentType}} {{#vendorExtensions.x-paramNameType}}{{{.}}}{{/vendorExtensions.x-paramNameType}}{{^vendorExtensions.x-paramNameType}}{{{dataType}}}{{/vendorExtensions.x-paramNameType}}{{/required}}{{/isBodyParam}}{{/allParams}}) :: {{#vendorExtensions.x-hasBodyOrFormParam}}(Consumes {{{vendorExtensions.x-operationType}}} {{>_contentType}}{{#allParams}}{{#isBodyParam}}{{#required}}, MimeRender {{>_contentType}} {{#vendorExtensions.x-paramNameType}}{{{.}}}{{/vendorExtensions.x-paramNameType}}{{^vendorExtensions.x-paramNameType}}{{{dataType}}}{{/vendorExtensions.x-paramNameType}}{{/required}}{{/isBodyParam}}{{/allParams}})
=> {{^vendorExtensions.x-inlineContentType}}contentType -- ^ request content-type ('MimeType') => {{^vendorExtensions.x-inlineContentType}}contentType -- ^ request content-type ('MimeType')
-> {{/vendorExtensions.x-inlineContentType}}{{/vendorExtensions.x-hasBodyOrFormParam}}{{#allParams}}{{#required}}{{#vendorExtensions.x-paramNameType}}{{{.}}}{{/vendorExtensions.x-paramNameType}}{{^vendorExtensions.x-paramNameType}}{{{dataType}}}{{/vendorExtensions.x-paramNameType}} -- ^ "{{{paramName}}}"{{#description}} - {{/description}} {{{description}}} -> {{/vendorExtensions.x-inlineContentType}}{{/vendorExtensions.x-hasBodyOrFormParam}}{{#allParams}}{{#required}}{{#vendorExtensions.x-paramNameType}}{{{.}}}{{/vendorExtensions.x-paramNameType}}{{^vendorExtensions.x-paramNameType}}{{{dataType}}}{{/vendorExtensions.x-paramNameType}} -- ^ "{{{paramName}}}"{{#description}} - {{{.}}}{{/description}}{{^required}}{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}{{/required}}
-> {{/required}}{{/allParams}}{{requestType}} {{{vendorExtensions.x-operationType}}} {{#vendorExtensions.x-hasBodyOrFormParam}}{{>_contentType}}{{/vendorExtensions.x-hasBodyOrFormParam}}{{^vendorExtensions.x-hasBodyOrFormParam}}MimeNoContent{{/vendorExtensions.x-hasBodyOrFormParam}} {{vendorExtensions.x-returnType}} -> {{/required}}{{/allParams}}{{requestType}} {{{vendorExtensions.x-operationType}}} {{#vendorExtensions.x-hasBodyOrFormParam}}{{>_contentType}}{{/vendorExtensions.x-hasBodyOrFormParam}}{{^vendorExtensions.x-hasBodyOrFormParam}}MimeNoContent{{/vendorExtensions.x-hasBodyOrFormParam}} {{vendorExtensions.x-returnType}}
{{operationId}} {{#vendorExtensions.x-hasBodyOrFormParam}}{{^vendorExtensions.x-inlineContentType}}_ {{/vendorExtensions.x-inlineContentType}}{{/vendorExtensions.x-hasBodyOrFormParam}}{{#allParams}}{{#required}}{{#isBodyParam}}{{{paramName}}}{{/isBodyParam}}{{^isBodyParam}}({{{vendorExtensions.x-paramNameType}}} {{{paramName}}}){{/isBodyParam}} {{/required}}{{/allParams}}= {{operationId}} {{#vendorExtensions.x-hasBodyOrFormParam}}{{^vendorExtensions.x-inlineContentType}}_ {{/vendorExtensions.x-inlineContentType}}{{/vendorExtensions.x-hasBodyOrFormParam}}{{#allParams}}{{#required}}{{#isBodyParam}}{{{paramName}}}{{/isBodyParam}}{{^isBodyParam}}({{{vendorExtensions.x-paramNameType}}} {{{paramName}}}){{/isBodyParam}} {{/required}}{{/allParams}}=
_mkRequest "{{httpMethod}}" {{{vendorExtensions.x-path}}}{{#authMethods}} _mkRequest "{{httpMethod}}" {{{vendorExtensions.x-path}}}{{#authMethods}}
@ -108,14 +108,12 @@ instance Produces {{{vendorExtensions.x-operationType}}} {{{x-mediaDataType}}}
-- * Parameter newtypes -- * Parameter newtypes
{{#x-allUniqueParams}}{{#x-newtype}}
newtype {{{x-paramNameType}}} = {{{x-paramNameType}}} { un{{{x-paramNameType}}} :: {{{x-dataType}}} } deriving (P.Eq, P.Show{{#x-isBodyParam}}, A.ToJSON{{/x-isBodyParam}}){{/x-newtype}}{{/x-allUniqueParams}}
{{#x-allUniqueParams}} {{#authMethods}}{{#-first}}-- * Auth Methods
newtype {{{vendorExtensions.x-paramNameType}}} = {{{vendorExtensions.x-paramNameType}}} { un{{{vendorExtensions.x-paramNameType}}} :: {{{dataType}}} } deriving (P.Eq, P.Show{{#isBodyParam}}, A.ToJSON{{/isBodyParam}})
{{/x-allUniqueParams}}
-- * Auth Methods {{/-first}}{{#isBasic}}-- ** {{name}}
{{#authMethods}}{{#isBasic}}-- ** {{name}}
data {{name}} = data {{name}} =
{{name}} B.ByteString B.ByteString -- ^ username password {{name}} B.ByteString B.ByteString -- ^ username password
deriving (P.Eq, P.Show, P.Typeable) deriving (P.Eq, P.Show, P.Typeable)

View File

@ -8,6 +8,8 @@ Module : {{title}}.Model
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE RecordWildCards #-}
@ -18,9 +20,11 @@ Module : {{title}}.Model
module {{title}}.Model where module {{title}}.Model where
import {{title}}.Core import {{title}}.Core
import {{title}}.MimeTypes
import Data.Aeson ((.:),(.:!),(.:?),(.=)) import Data.Aeson ((.:),(.:!),(.:?),(.=))
import qualified Control.Arrow as P (left)
import qualified Data.Aeson as A import qualified Data.Aeson as A
import qualified Data.ByteString as B import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy as BL
@ -39,7 +43,7 @@ import qualified Web.HttpApiData as WH
import Control.Applicative ((<|>)) import Control.Applicative ((<|>))
import Control.Applicative (Alternative) import Control.Applicative (Alternative)
import Data.Text (Text) import Data.Text (Text)
import Prelude (($), (.),(<$>),(<*>),(>>=),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor) import Prelude (($), (.),(<$>),(<*>),(>>=),(=<<),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor)
import qualified Prelude as P import qualified Prelude as P
@ -50,18 +54,17 @@ import qualified Prelude as P
-- * Models -- * Models
{{#models}} {{#models}}
{{#model}} {{#model}}{{^isEnum}}
-- ** {{classname}} -- ** {{classname}}
-- | {{classname}}{{#title}} -- | {{classname}}{{#title}}
-- {{{.}}} -- {{{.}}}
-- {{/title}}{{#description}} -- {{/title}}{{#description}}
-- {{{.}}}{{/description}}{{#isAlias}} -- {{{.}}}{{/description}}{{#isAlias}}
newtype {{classname}} = {{classname}} newtype {{classname}} = {{classname}}
{ un{{classname}} :: {{{dataType}}} { un{{classname}} :: {{{vendorExtensions.x-dataType}}}
} deriving (P.Eq, P.Show, P.Typeable, A.ToJSON, A.FromJSON, WH.ToHttpApiData, WH.FromHttpApiData{{#modelDeriving}}, {{modelDeriving}}{{/modelDeriving}}){{/isAlias}}{{^isAlias}} } deriving (P.Eq, P.Show, P.Typeable, A.ToJSON, A.FromJSON, WH.ToHttpApiData, WH.FromHttpApiData{{#modelDeriving}}, {{modelDeriving}}{{/modelDeriving}}){{/isAlias}}{{^isAlias}}
data {{classname}} = {{classname}} data {{classname}} = {{classname}}
{ {{#vars}}{{name}} :: {{#x-strictFields}}!({{/x-strictFields}}{{^required}}Maybe {{/required}}{{datatype}}{{#x-strictFields}}){{/x-strictFields}} -- ^ {{#required}}/Required/ {{/required}}{{#readOnly}}/ReadOnly/ {{/readOnly}}"{{baseName}}"{{#description}} - {{description}}{{/description}}{{#hasMore}} { {{#vars}}{{name}} :: {{#x-strictFields}}!({{/x-strictFields}}{{^required}}Maybe {{/required}}{{{vendorExtensions.x-dataType}}}{{#x-strictFields}}){{/x-strictFields}} -- ^ {{#required}}/Required/ {{/required}}{{#readOnly}}/ReadOnly/ {{/readOnly}}"{{baseName}}"{{#description}} - {{description}}{{/description}}{{#hasMore}}
, {{/hasMore}}{{/vars}} , {{/hasMore}}{{/vars}}
} deriving (P.Show, P.Eq, P.Typeable{{#modelDeriving}}, {{modelDeriving}}{{/modelDeriving}}){{/isAlias}} } deriving (P.Show, P.Eq, P.Typeable{{#modelDeriving}}, {{modelDeriving}}{{/modelDeriving}}){{/isAlias}}
@ -100,17 +103,40 @@ instance WH.ToForm {{classname}} where
{{#generateModelConstructors}} {{#generateModelConstructors}}
-- | Construct a value of type '{{classname}}' (by applying it's required fields, if any) -- | Construct a value of type '{{classname}}' (by applying it's required fields, if any)
mk{{classname}} mk{{classname}}
:: {{#requiredVars}}{{{datatype}}} -- ^ '{{name}}'{{#description}}:{{/description}} {{{description}}} :: {{#requiredVars}}{{{vendorExtensions.x-dataType}}} -- ^ '{{name}}'{{#description}}:{{/description}} {{{description}}}
-> {{/requiredVars}}{{classname}} -> {{/requiredVars}}{{classname}}
mk{{classname}} {{#requiredVars}}{{name}} {{/requiredVars}}= mk{{classname}} {{#requiredVars}}{{name}} {{/requiredVars}}=
{{classname}} {{classname}}
{ {{#vars}}{{#required}}{{name}}{{/required}}{{^required}}{{name}} = {{#isListContainer}}Nothing{{/isListContainer}}{{#isMapContainer}}Nothing{{/isMapContainer}}{{^isContainer}}Nothing{{/isContainer}}{{/required}}{{#hasMore}} { {{#vars}}{{#required}}{{name}}{{/required}}{{^required}}{{name}} = {{#isListContainer}}Nothing{{/isListContainer}}{{#isMapContainer}}Nothing{{/isMapContainer}}{{^isContainer}}Nothing{{/isContainer}}{{/required}}{{#hasMore}}
, {{/hasMore}}{{/vars}} , {{/hasMore}}{{/vars}}
} }
{{/generateModelConstructors}} {{/generateModelConstructors}}{{/isAlias}}{{/isEnum}}{{/model}}{{/models}}
{{/isAlias}}
{{/model}} {{#x-hasEnumSection}}-- * Enums
{{/models}} {{#x-allUniqueParams}}{{#x-enum}}
-- ** {{{x-paramNameType}}}
-- | Enum of '{{{x-dataType}}}'{{#description}} .
-- {{{.}}}{{/description}}
data {{{x-paramNameType}}}
= {{#allowableValues}}{{#enumVars}}{{{name}}} -- ^ @{{{value}}}@
{{^-last}}| {{/-last}}{{#-last}}deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum){{/-last}}{{/enumVars}}{{/allowableValues}}
instance A.ToJSON {{{x-paramNameType}}} where toJSON = A.toJSON . from{{{x-paramNameType}}}
instance A.FromJSON {{{x-paramNameType}}} where parseJSON o = P.either P.fail (pure . P.id) . to{{{x-paramNameType}}} =<< A.parseJSON o
instance WH.ToHttpApiData {{{x-paramNameType}}} where toQueryParam = WH.toQueryParam . from{{{x-paramNameType}}}
instance WH.FromHttpApiData {{{x-paramNameType}}} where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . to{{{x-paramNameType}}}
instance MimeRender MimeMultipartFormData {{{x-paramNameType}}} where mimeRender _ = mimeRenderDefaultMultipartFormData
-- | unwrap '{{{x-paramNameType}}}' enum
from{{{x-paramNameType}}} :: {{{x-paramNameType}}} -> {{{x-dataType}}}
from{{{x-paramNameType}}} = \case{{#allowableValues}}{{#enumVars}}
{{{name}}} -> {{{value}}}{{/enumVars}}{{/allowableValues}}
-- | parse '{{{x-paramNameType}}}' enum
to{{{x-paramNameType}}} :: {{{x-dataType}}} -> P.Either String {{{x-paramNameType}}}
to{{{x-paramNameType}}} = \case{{#allowableValues}}{{#enumVars}}
{{{value}}} -> P.Right {{{name}}}{{/enumVars}}{{/allowableValues}}
s -> P.Left $ "to{{{x-paramNameType}}}: enum parse failure: " P.++ P.show s
{{/x-enum}}{{/x-allUniqueParams}}{{/x-hasEnumSection}}

View File

@ -33,7 +33,7 @@ import {{title}}.Core
{{#vars}} {{#vars}}
-- | '{{name}}' Lens -- | '{{name}}' Lens
{{name}}L :: Lens_' {{classname}} ({{^required}}Maybe {{/required}}{{datatype}}) {{name}}L :: Lens_' {{classname}} ({{^required}}Maybe {{/required}}{{{vendorExtensions.x-dataType}}})
{{name}}L f {{classname}}{..} = (\{{name}} -> {{classname}} { {{name}}, ..} ) <$> f {{name}} {{name}}L f {{classname}}{..} = (\{{name}} -> {{classname}} { {{name}}, ..} ) <$> f {{name}}
{-# INLINE {{name}}L #-} {-# INLINE {{name}}L #-}

View File

@ -48,11 +48,6 @@ haskell-http-client
* Model Inheritance * Model Inheritance
* Default Parameter Values
* Enum Parameters
This is beta software; other cases may not be supported. This is beta software; other cases may not be supported.
### Codegen "additional properties" parameters ### Codegen "additional properties" parameters
@ -67,6 +62,7 @@ These options allow some customization of the code generation process.
| allowToJsonNulls | allow emitting JSON Null during model encoding to JSON | false | {{{allowToJsonNulls}}} | | allowToJsonNulls | allow emitting JSON Null during model encoding to JSON | false | {{{allowToJsonNulls}}} |
| dateFormat | format string used to parse/render a date | %Y-%m-%d | {{{dateFormat}}} | | dateFormat | format string used to parse/render a date | %Y-%m-%d | {{{dateFormat}}} |
| dateTimeFormat | format string used to parse/render a datetime. (Defaults to [formatISO8601Millis][1] when not provided) | | {{{dateTimeFormat}}} | | dateTimeFormat | format string used to parse/render a datetime. (Defaults to [formatISO8601Millis][1] when not provided) | | {{{dateTimeFormat}}} |
| generateEnums | Generate specific datatypes for swagger enums | true | {{{generateEnums}}} |
| generateFormUrlEncodedInstances | Generate FromForm/ToForm instances for models used by x-www-form-urlencoded operations (model fields must be primitive types) | true | {{{generateFormUrlEncodedInstances}}} | | generateFormUrlEncodedInstances | Generate FromForm/ToForm instances for models used by x-www-form-urlencoded operations (model fields must be primitive types) | true | {{{generateFormUrlEncodedInstances}}} |
| generateLenses | Generate Lens optics for Models | true | {{{generateLenses}}} | | generateLenses | Generate Lens optics for Models | true | {{{generateLenses}}} |
| generateModelConstructors | Generate smart constructors (only supply required fields) for models | true | {{{generateModelConstructors}}} | | generateModelConstructors | Generate smart constructors (only supply required fields) for models | true | {{{generateModelConstructors}}} |

View File

@ -44,7 +44,7 @@ library
, bytestring >=0.10.0 && <0.11 , bytestring >=0.10.0 && <0.11
, base64-bytestring >1.0 && <2.0 , base64-bytestring >1.0 && <2.0
, containers >=0.5.0.0 && <0.6 , containers >=0.5.0.0 && <0.6
, http-types >=0.8 && <0.10 , http-types >=0.8 && <0.11
, http-client >=0.5 && <0.6 , http-client >=0.5 && <0.6
, http-client-tls , http-client-tls
, http-api-data >= 0.3.4 && <0.4 , http-api-data >= 0.3.4 && <0.4

View File

@ -1,4 +1,4 @@
resolver: lts-9.0 resolver: lts-9.10
build: build:
haddock-arguments: haddock-arguments:
haddock-args: haddock-args:

View File

@ -91,13 +91,19 @@ instance ApproxEq TI.Day where
{{#models}} {{#models}}
{{#model}} {{#model}}
{{^isEnum}}
instance Arbitrary {{classname}} where instance Arbitrary {{classname}} where
arbitrary = arbitrary =
{{#isAlias}}{{classname}} <$> arbitrary{{/isAlias}}{{^isAlias}}{{^hasVars}} {{#isAlias}}{{classname}} <$> arbitrary{{/isAlias}}{{^isAlias}}{{^hasVars}}
pure {{/hasVars}}{{classname}} pure {{/hasVars}}{{classname}}
{{#hasVars}} <$>{{/hasVars}} {{#vars}}arbitrary -- {{name}} :: {{^required}}Maybe {{/required}}{{datatype}} {{#hasVars}} <$>{{/hasVars}} {{#vars}}arbitrary -- {{name}} :: {{^required}}Maybe {{/required}}{{datatype}}
{{#hasMore}} <*> {{/hasMore}}{{/vars}}{{/isAlias}} {{#hasMore}} <*> {{/hasMore}}{{/vars}}{{/isAlias}}
{{/isEnum}}
{{/model}} {{/model}}
{{/models}} {{/models}}
{{#x-allUniqueParams}}{{#x-enum}}
instance Arbitrary {{{x-paramNameType}}} where
arbitrary = arbitraryBoundedEnum
{{/x-enum}}{{/x-allUniqueParams}}

View File

@ -36,6 +36,8 @@ public class HaskellHttpClientOptionsTest extends AbstractOptionsTest {
times = 1; times = 1;
clientCodegen.setGenerateModelConstructors(Boolean.valueOf(HaskellHttpClientOptionsProvider.GENERATE_MODEL_CONSTRUCTORS)); clientCodegen.setGenerateModelConstructors(Boolean.valueOf(HaskellHttpClientOptionsProvider.GENERATE_MODEL_CONSTRUCTORS));
times = 1; times = 1;
clientCodegen.setGenerateEnums(Boolean.valueOf(HaskellHttpClientOptionsProvider.GENERATE_ENUMS));
times = 1;
clientCodegen.setGenerateFormUrlEncodedInstances(Boolean.valueOf(HaskellHttpClientOptionsProvider.GENERATE_FORM_URLENCODED_INSTANCES)); clientCodegen.setGenerateFormUrlEncodedInstances(Boolean.valueOf(HaskellHttpClientOptionsProvider.GENERATE_FORM_URLENCODED_INSTANCES));
times = 1; times = 1;
clientCodegen.setGenerateLenses(Boolean.valueOf(HaskellHttpClientOptionsProvider.GENERATE_LENSES)); clientCodegen.setGenerateLenses(Boolean.valueOf(HaskellHttpClientOptionsProvider.GENERATE_LENSES));

View File

@ -1,5 +1,8 @@
package io.swagger.codegen.languages; package io.swagger.codegen.languages;
import static io.swagger.codegen.languages.JavaClientCodegen.RETROFIT_2;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -9,6 +12,11 @@ import java.util.Map;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
import io.swagger.codegen.CodegenOperation;
import io.swagger.codegen.CodegenParameter;
public class JavaClientCodegenTest { public class JavaClientCodegenTest {
private static final String VENDOR_MIME_TYPE = "application/vnd.company.v1+json"; private static final String VENDOR_MIME_TYPE = "application/vnd.company.v1+json";
@ -74,4 +82,53 @@ public class JavaClientCodegenTest {
Assert.assertNull(priContentTypes.get(3).get("hasMore")); Assert.assertNull(priContentTypes.get(3).get("hasMore"));
} }
@Test
public void testParametersAreCorrectlyOrderedWhenUsingRetrofit(){
JavaClientCodegen javaClientCodegen = new JavaClientCodegen();
javaClientCodegen.setLibrary(RETROFIT_2);
CodegenOperation codegenOperation = new CodegenOperation();
CodegenParameter queryParamRequired = createQueryParam("queryParam1", true);
CodegenParameter queryParamOptional = createQueryParam("queryParam2", false);
CodegenParameter pathParam1 = createPathParam("pathParam1");
CodegenParameter pathParam2 = createPathParam("pathParam2");
codegenOperation.allParams = Arrays.asList(queryParamRequired, pathParam1, pathParam2, queryParamOptional);
Map<String, Object> operations = ImmutableMap.<String, Object>of("operation", Arrays.asList(codegenOperation));
Map<String, Object> objs = ImmutableMap.of("operations", operations, "imports", new ArrayList<Map<String, String>>());
javaClientCodegen.postProcessOperations(objs);
Assert.assertEquals(Arrays.asList(pathParam1, pathParam2, queryParamRequired, queryParamOptional), codegenOperation.allParams);
Assert.assertTrue(pathParam1.hasMore);
Assert.assertTrue(pathParam2.hasMore);
Assert.assertTrue(queryParamRequired.hasMore);
Assert.assertFalse(queryParamOptional.hasMore);
}
private CodegenParameter createPathParam(String name) {
CodegenParameter codegenParameter = createStringParam(name);
codegenParameter.isPathParam = true;
return codegenParameter;
}
private CodegenParameter createQueryParam(String name, boolean required) {
CodegenParameter codegenParameter = createStringParam(name);
codegenParameter.isQueryParam = true;
codegenParameter.required = required;
return codegenParameter;
}
private CodegenParameter createStringParam(String name){
CodegenParameter codegenParameter = new CodegenParameter();
codegenParameter.paramName = name;
codegenParameter.baseName = name;
codegenParameter.dataType = "String";
return codegenParameter;
}
} }

View File

@ -20,6 +20,7 @@ public class HaskellHttpClientOptionsProvider implements OptionsProvider {
public static final String DATE_FORMAT = "%Y-%m-%d"; public static final String DATE_FORMAT = "%Y-%m-%d";
public static final String MODEL_DERIVING = ""; public static final String MODEL_DERIVING = "";
public static final String STRICT_FIELDS = "false"; public static final String STRICT_FIELDS = "false";
public static final String GENERATE_ENUMS = "true";
public static final String GENERATE_FORM_URLENCODED_INSTANCES = "true"; public static final String GENERATE_FORM_URLENCODED_INSTANCES = "true";
public static final String GENERATE_LENSES = "true"; public static final String GENERATE_LENSES = "true";
public static final String GENERATE_MODEL_CONSTRUCTORS = "true"; public static final String GENERATE_MODEL_CONSTRUCTORS = "true";
@ -46,6 +47,7 @@ public class HaskellHttpClientOptionsProvider implements OptionsProvider {
.put(HaskellHttpClientCodegen.PROP_DATETIME_FORMAT, DATETIME_FORMAT) .put(HaskellHttpClientCodegen.PROP_DATETIME_FORMAT, DATETIME_FORMAT)
.put(HaskellHttpClientCodegen.PROP_DATE_FORMAT, DATE_FORMAT) .put(HaskellHttpClientCodegen.PROP_DATE_FORMAT, DATE_FORMAT)
.put(HaskellHttpClientCodegen.PROP_MODEL_DERIVING, MODEL_DERIVING) .put(HaskellHttpClientCodegen.PROP_MODEL_DERIVING, MODEL_DERIVING)
.put(HaskellHttpClientCodegen.PROP_GENERATE_ENUMS, GENERATE_ENUMS)
.put(HaskellHttpClientCodegen.PROP_GENERATE_FORM_URLENCODED_INSTANCES, GENERATE_FORM_URLENCODED_INSTANCES) .put(HaskellHttpClientCodegen.PROP_GENERATE_FORM_URLENCODED_INSTANCES, GENERATE_FORM_URLENCODED_INSTANCES)
.put(HaskellHttpClientCodegen.PROP_GENERATE_LENSES, GENERATE_LENSES) .put(HaskellHttpClientCodegen.PROP_GENERATE_LENSES, GENERATE_LENSES)
.put(HaskellHttpClientCodegen.PROP_GENERATE_MODEL_CONSTRUCTORS, GENERATE_MODEL_CONSTRUCTORS) .put(HaskellHttpClientCodegen.PROP_GENERATE_MODEL_CONSTRUCTORS, GENERATE_MODEL_CONSTRUCTORS)

View File

@ -0,0 +1,185 @@
# Ref: https://gist.github.com/kmorcinek/2710267
# Download this file using PowerShell v3 under Windows with the following comand
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# OS generated files #
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
modulesbin/
tempbin/
# EPiServer Site file (VPP)
AppData/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# vim
*.txt~
*.swp
*.swo
# svn
.svn
# SQL Server files
**/App_Data/*.mdf
**/App_Data/*.ldf
**/App_Data/*.sdf
#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
# SASS Compiler cache
.sass-cache
# Visual Studio 2014 CTP
**/*.sln.ide

View File

@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1 @@
2.3.0-SNAPSHOT

View File

@ -0,0 +1,9 @@
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
language: csharp
mono:
- latest
solution: IO.Swagger.sln
script:
- /bin/sh ./mono_nunit_test.sh

View File

@ -0,0 +1,27 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
VisualStudioVersion = 12.0.0.0
MinimumVisualStudioVersion = 10.0.0.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,202 @@
# IO.Swagger - the C# library for the Swagger Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.0
- SDK version: 1.0.0
- Build package: io.swagger.codegen.languages.CSharpClientCodegen
<a name="frameworks-supported"></a>
## Frameworks supported
- .NET 4.0 or later
- Windows Phone 7.1 (Mango)
<a name="dependencies"></a>
## Dependencies
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
```
Install-Package RestSharp
Install-Package Newtonsoft.Json
```
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
<a name="installation"></a>
## Installation
Run the following command to generate the DLL
- [Mac/Linux] `/bin/sh build.sh`
- [Windows] `build.bat`
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
```csharp
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
```
<a name="packaging"></a>
## Packaging
A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages.
This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly:
```
nuget pack -Build -OutputDirectory out IO.Swagger.csproj
```
Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual.
<a name="getting-started"></a>
## Getting Started
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class Example
{
public void main()
{
var apiInstance = new AnotherFakeApi();
var body = new ModelClient(); // ModelClient | client model
try
{
// To test special tags
ModelClient result = apiInstance.TestSpecialTags(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message );
}
}
}
}
```
<a name="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io:80/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters
*FakeApi* | [**TestInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
*FakeApi* | [**TestJsonFormData**](docs/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data
*FakeClassnameTags123Api* | [**TestClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a name="documentation-for-models"></a>
## Documentation for Models
- [Model.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- [Model.Animal](docs/Animal.md)
- [Model.AnimalFarm](docs/AnimalFarm.md)
- [Model.ApiResponse](docs/ApiResponse.md)
- [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Model.ArrayTest](docs/ArrayTest.md)
- [Model.Capitalization](docs/Capitalization.md)
- [Model.Category](docs/Category.md)
- [Model.ClassModel](docs/ClassModel.md)
- [Model.EnumArrays](docs/EnumArrays.md)
- [Model.EnumClass](docs/EnumClass.md)
- [Model.EnumTest](docs/EnumTest.md)
- [Model.FormatTest](docs/FormatTest.md)
- [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- [Model.List](docs/List.md)
- [Model.MapTest](docs/MapTest.md)
- [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model.Model200Response](docs/Model200Response.md)
- [Model.ModelClient](docs/ModelClient.md)
- [Model.ModelReturn](docs/ModelReturn.md)
- [Model.Name](docs/Name.md)
- [Model.NumberOnly](docs/NumberOnly.md)
- [Model.Order](docs/Order.md)
- [Model.OuterBoolean](docs/OuterBoolean.md)
- [Model.OuterComposite](docs/OuterComposite.md)
- [Model.OuterEnum](docs/OuterEnum.md)
- [Model.OuterNumber](docs/OuterNumber.md)
- [Model.OuterString](docs/OuterString.md)
- [Model.Pet](docs/Pet.md)
- [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [Model.SpecialModelName](docs/SpecialModelName.md)
- [Model.Tag](docs/Tag.md)
- [Model.User](docs/User.md)
- [Model.Cat](docs/Cat.md)
- [Model.Dog](docs/Dog.md)
<a name="documentation-for-authorization"></a>
## Documentation for Authorization
<a name="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
<a name="api_key_query"></a>
### api_key_query
- **Type**: API key
- **API key parameter name**: api_key_query
- **Location**: URL query string
<a name="http_basic_test"></a>
### http_basic_test
- **Type**: HTTP basic authentication
<a name="petstore_auth"></a>
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account
- read:pets: read your pets

View File

@ -0,0 +1,16 @@
:: Generated by: https://github.com/swagger-api/swagger-codegen.git
::
@echo off
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v3.5
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.\nuget.exe')"
.\nuget.exe install src\IO.Swagger\packages.config -o packages
if not exist ".\bin" mkdir bin
copy packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll
copy packages\RestSharp.105.1.0\lib\net4\RestSharp.dll bin\RestSharp.dll
%CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll /target:library /out:bin\IO.Swagger.dll /recurse:src\IO.Swagger\*.cs /doc:bin\IO.Swagger.xml

View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
frameworkVersion=net40
netfx=${frameworkVersion#net}
echo "[INFO] Target framework: ${frameworkVersion}"
echo "[INFO] Download nuget and packages"
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
mozroots --import --sync
mono nuget.exe install src/IO.Swagger/packages.config -o packages;
echo "[INFO] Copy DLLs to the 'bin' folder"
mkdir -p bin;
cp packages/Newtonsoft.Json.4.5.11/lib/net40/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
cp packages/RestSharp.105.1.0/lib/net4/RestSharp.dll bin/RestSharp.dll;
echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll"
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
bin/RestSharp.dll,\
System.ComponentModel.DataAnnotations.dll,\
System.Runtime.Serialization.dll \
-target:library \
-out:bin/IO.Swagger.dll \
-recurse:'src/IO.Swagger/*.cs' \
-doc:bin/IO.Swagger.xml \
-platform:anycpu
if [ $? -ne 0 ]
then
echo "[ERROR] Compilation failed with exit code $?"
exit 1
else
echo "[INFO] bin/IO.Swagger.dll was created successfully"
fi

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.AdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MapProperty** | **Dictionary&lt;string, string&gt;** | | [optional]
**MapOfMapProperty** | **Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.Animal
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
**Color** | **string** | | [optional] [default to "red"]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,8 @@
# IO.Swagger.Model.AnimalFarm
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,70 @@
# IO.Swagger.Api.AnotherFakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags
<a name="testspecialtags"></a>
# **TestSpecialTags**
> ModelClient TestSpecialTags (ModelClient body)
To test special tags
To test special tags
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class TestSpecialTagsExample
{
public void main()
{
var apiInstance = new AnotherFakeApi();
var body = new ModelClient(); // ModelClient | client model
try
{
// To test special tags
ModelClient result = apiInstance.TestSpecialTags(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**ModelClient**](ModelClient.md)| client model |
### Return type
[**ModelClient**](ModelClient.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# IO.Swagger.Model.ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **int?** | | [optional]
**Type** | **string** | | [optional]
**Message** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# IO.Swagger.Model.ArrayOfArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayArrayNumber** | **List&lt;List&lt;decimal?&gt;&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# IO.Swagger.Model.ArrayOfNumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayNumber** | **List&lt;decimal?&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# IO.Swagger.Model.ArrayTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ArrayOfString** | **List&lt;string&gt;** | | [optional]
**ArrayArrayOfInteger** | **List&lt;List&lt;long?&gt;&gt;** | | [optional]
**ArrayArrayOfModel** | **List&lt;List&lt;ReadOnlyFirst&gt;&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,14 @@
# IO.Swagger.Model.Capitalization
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**SmallCamel** | **string** | | [optional]
**CapitalCamel** | **string** | | [optional]
**SmallSnake** | **string** | | [optional]
**CapitalSnake** | **string** | | [optional]
**SCAETHFlowPoints** | **string** | | [optional]
**ATT_NAME** | **string** | Name of the pet | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# IO.Swagger.Model.Cat
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
**Color** | **string** | | [optional] [default to "red"]
**Declawed** | **bool?** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.Category
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Name** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# IO.Swagger.Model.ClassModel
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_Class** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# IO.Swagger.Model.Dog
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ClassName** | **string** | |
**Color** | **string** | | [optional] [default to "red"]
**Breed** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.EnumArrays
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**JustSymbol** | **string** | | [optional]
**ArrayEnum** | **List&lt;string&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,8 @@
# IO.Swagger.Model.EnumClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# IO.Swagger.Model.EnumTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**EnumString** | **string** | | [optional]
**EnumInteger** | **int?** | | [optional]
**EnumNumber** | **double?** | | [optional]
**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,604 @@
# IO.Swagger.Api.FakeApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**FakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean |
[**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite |
[**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number |
[**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string |
[**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model
[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**TestEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters
[**TestInlineAdditionalProperties**](FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
[**TestJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data
<a name="fakeouterbooleanserialize"></a>
# **FakeOuterBooleanSerialize**
> OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null)
Test serialization of outer boolean types
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class FakeOuterBooleanSerializeExample
{
public void main()
{
var apiInstance = new FakeApi();
var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional)
try
{
OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional]
### Return type
[**OuterBoolean**](OuterBoolean.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="fakeoutercompositeserialize"></a>
# **FakeOuterCompositeSerialize**
> OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null)
Test serialization of object with outer number type
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class FakeOuterCompositeSerializeExample
{
public void main()
{
var apiInstance = new FakeApi();
var body = new OuterComposite(); // OuterComposite | Input composite as post body (optional)
try
{
OuterComposite result = apiInstance.FakeOuterCompositeSerialize(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
### Return type
[**OuterComposite**](OuterComposite.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="fakeouternumberserialize"></a>
# **FakeOuterNumberSerialize**
> OuterNumber FakeOuterNumberSerialize (OuterNumber body = null)
Test serialization of outer number types
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class FakeOuterNumberSerializeExample
{
public void main()
{
var apiInstance = new FakeApi();
var body = new OuterNumber(); // OuterNumber | Input number as post body (optional)
try
{
OuterNumber result = apiInstance.FakeOuterNumberSerialize(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional]
### Return type
[**OuterNumber**](OuterNumber.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="fakeouterstringserialize"></a>
# **FakeOuterStringSerialize**
> OuterString FakeOuterStringSerialize (OuterString body = null)
Test serialization of outer string types
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class FakeOuterStringSerializeExample
{
public void main()
{
var apiInstance = new FakeApi();
var body = new OuterString(); // OuterString | Input string as post body (optional)
try
{
OuterString result = apiInstance.FakeOuterStringSerialize(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**OuterString**](OuterString.md)| Input string as post body | [optional]
### Return type
[**OuterString**](OuterString.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="testclientmodel"></a>
# **TestClientModel**
> ModelClient TestClientModel (ModelClient body)
To test \"client\" model
To test \"client\" model
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class TestClientModelExample
{
public void main()
{
var apiInstance = new FakeApi();
var body = new ModelClient(); // ModelClient | client model
try
{
// To test \"client\" model
ModelClient result = apiInstance.TestClientModel(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**ModelClient**](ModelClient.md)| client model |
### Return type
[**ModelClient**](ModelClient.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="testendpointparameters"></a>
# **TestEndpointParameters**
> void TestEndpointParameters (decimal? number, double? _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null)
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class TestEndpointParametersExample
{
public void main()
{
// Configure HTTP basic authorization: http_basic_test
Configuration.Default.Username = "YOUR_USERNAME";
Configuration.Default.Password = "YOUR_PASSWORD";
var apiInstance = new FakeApi();
var number = 3.4; // decimal? | None
var _double = 1.2; // double? | None
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
var _byte = _byte_example; // byte[] | None
var integer = 56; // int? | None (optional)
var int32 = 56; // int? | None (optional)
var int64 = 789; // long? | None (optional)
var _float = 3.4; // float? | None (optional)
var _string = _string_example; // string | None (optional)
var binary = B; // byte[] | None (optional)
var date = 2013-10-20; // DateTime? | None (optional)
var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional)
var password = password_example; // string | None (optional)
var callback = callback_example; // string | None (optional)
try
{
// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
apiInstance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**number** | **decimal?**| None |
**_double** | **double?**| None |
**patternWithoutDelimiter** | **string**| None |
**_byte** | **byte[]**| None |
**integer** | **int?**| None | [optional]
**int32** | **int?**| None | [optional]
**int64** | **long?**| None | [optional]
**_float** | **float?**| None | [optional]
**_string** | **string**| None | [optional]
**binary** | **byte[]**| None | [optional]
**date** | **DateTime?**| None | [optional]
**dateTime** | **DateTime?**| None | [optional]
**password** | **string**| None | [optional]
**callback** | **string**| None | [optional]
### Return type
void (empty response body)
### Authorization
[http_basic_test](../README.md#http_basic_test)
### HTTP request headers
- **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8
- **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="testenumparameters"></a>
# **TestEnumParameters**
> void TestEnumParameters (List<string> enumFormStringArray = null, string enumFormString = null, List<string> enumHeaderStringArray = null, string enumHeaderString = null, List<string> enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null)
To test enum parameters
To test enum parameters
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class TestEnumParametersExample
{
public void main()
{
var apiInstance = new FakeApi();
var enumFormStringArray = new List<string>(); // List<string> | Form parameter enum test (string array) (optional)
var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg)
var enumHeaderStringArray = new List<string>(); // List<string> | Header parameter enum test (string array) (optional)
var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg)
var enumQueryStringArray = new List<string>(); // List<string> | Query parameter enum test (string array) (optional)
var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg)
var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional)
var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional)
try
{
// To test enum parameters
apiInstance.TestEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeApi.TestEnumParameters: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enumFormStringArray** | [**List&lt;string&gt;**](string.md)| Form parameter enum test (string array) | [optional]
**enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg]
**enumHeaderStringArray** | [**List&lt;string&gt;**](string.md)| Header parameter enum test (string array) | [optional]
**enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg]
**enumQueryStringArray** | [**List&lt;string&gt;**](string.md)| Query parameter enum test (string array) | [optional]
**enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg]
**enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional]
**enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional]
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: */*
- **Accept**: */*
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="testinlineadditionalproperties"></a>
# **TestInlineAdditionalProperties**
> void TestInlineAdditionalProperties (Object param)
test inline additionalProperties
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class TestInlineAdditionalPropertiesExample
{
public void main()
{
var apiInstance = new FakeApi();
var param = ; // Object | request body
try
{
// test inline additionalProperties
apiInstance.TestInlineAdditionalProperties(param);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeApi.TestInlineAdditionalProperties: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **Object**| request body |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="testjsonformdata"></a>
# **TestJsonFormData**
> void TestJsonFormData (string param, string param2)
test json serialization of form data
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class TestJsonFormDataExample
{
public void main()
{
var apiInstance = new FakeApi();
var param = param_example; // string | field1
var param2 = param2_example; // string | field2
try
{
// test json serialization of form data
apiInstance.TestJsonFormData(param, param2);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeApi.TestJsonFormData: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **string**| field1 |
**param2** | **string**| field2 |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,73 @@
# IO.Swagger.Api.FakeClassnameTags123Api
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**TestClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case
<a name="testclassname"></a>
# **TestClassname**
> ModelClient TestClassname (ModelClient body)
To test class name in snake case
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class TestClassnameExample
{
public void main()
{
// Configure API key authorization: api_key_query
Configuration.Default.AddApiKey("api_key_query", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.AddApiKeyPrefix("api_key_query", "Bearer");
var apiInstance = new FakeClassnameTags123Api();
var body = new ModelClient(); // ModelClient | client model
try
{
// To test class name in snake case
ModelClient result = apiInstance.TestClassname(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**ModelClient**](ModelClient.md)| client model |
### Return type
[**ModelClient**](ModelClient.md)
### Authorization
[api_key_query](../README.md#api_key_query)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,21 @@
# IO.Swagger.Model.FormatTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Integer** | **int?** | | [optional]
**Int32** | **int?** | | [optional]
**Int64** | **long?** | | [optional]
**Number** | **decimal?** | |
**_Float** | **float?** | | [optional]
**_Double** | **double?** | | [optional]
**_String** | **string** | | [optional]
**_Byte** | **byte[]** | |
**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)

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.HasOnlyReadOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Bar** | **string** | | [optional]
**Foo** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# IO.Swagger.Model.List
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_123List** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.MapTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MapMapOfString** | **Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt;** | | [optional]
**MapOfEnumString** | **Dictionary&lt;string, string&gt;** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# IO.Swagger.Model.MixedPropertiesAndAdditionalPropertiesClass
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Uuid** | **Guid?** | | [optional]
**DateTime** | **DateTime?** | | [optional]
**Map** | [**Dictionary&lt;string, Animal&gt;**](Animal.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.Model200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **int?** | | [optional]
**_Class** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# IO.Swagger.Model.ModelClient
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_Client** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# IO.Swagger.Model.ModelReturn
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_Return** | **int?** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# IO.Swagger.Model.Name
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_Name** | **int?** | |
**SnakeCase** | **int?** | | [optional]
**Property** | **string** | | [optional]
**_123Number** | **int?** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# IO.Swagger.Model.NumberOnly
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**JustNumber** | **decimal?** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,14 @@
# IO.Swagger.Model.Order
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**PetId** | **long?** | | [optional]
**Quantity** | **int?** | | [optional]
**ShipDate** | **DateTime?** | | [optional]
**Status** | **string** | Order Status | [optional]
**Complete** | **bool?** | | [optional] [default to false]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,8 @@
# IO.Swagger.Model.OuterBoolean
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# IO.Swagger.Model.OuterComposite
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**MyNumber** | [**OuterNumber**](OuterNumber.md) | | [optional]
**MyString** | [**OuterString**](OuterString.md) | | [optional]
**MyBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,8 @@
# IO.Swagger.Model.OuterEnum
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,8 @@
# IO.Swagger.Model.OuterNumber
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,8 @@
# IO.Swagger.Model.OuterString
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,14 @@
# IO.Swagger.Model.Pet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Category** | [**Category**](Category.md) | | [optional]
**Name** | **string** | |
**PhotoUrls** | **List&lt;string&gt;** | |
**Tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional]
**Status** | **string** | pet status in the store | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,536 @@
# IO.Swagger.Api.PetApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**AddPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
[**DeletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
[**FindPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
[**FindPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
[**GetPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
[**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
[**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
[**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
<a name="addpet"></a>
# **AddPet**
> void AddPet (Pet body)
Add a new pet to the store
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class AddPetExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
try
{
// Add a new pet to the store
apiInstance.AddPet(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.AddPet: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="deletepet"></a>
# **DeletePet**
> void DeletePet (long? petId, string apiKey = null)
Deletes a pet
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class DeletePetExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var petId = 789; // long? | Pet id to delete
var apiKey = apiKey_example; // string | (optional)
try
{
// Deletes a pet
apiInstance.DeletePet(petId, apiKey);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **long?**| Pet id to delete |
**apiKey** | **string**| | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="findpetsbystatus"></a>
# **FindPetsByStatus**
> List<Pet> FindPetsByStatus (List<string> status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class FindPetsByStatusExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var status = new List<string>(); // List<string> | Status values that need to be considered for filter
try
{
// Finds Pets by status
List&lt;Pet&gt; result = apiInstance.FindPetsByStatus(status);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | [**List&lt;string&gt;**](string.md)| Status values that need to be considered for filter |
### Return type
[**List<Pet>**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="findpetsbytags"></a>
# **FindPetsByTags**
> List<Pet> FindPetsByTags (List<string> tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class FindPetsByTagsExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var tags = new List<string>(); // List<string> | Tags to filter by
try
{
// Finds Pets by tags
List&lt;Pet&gt; result = apiInstance.FindPetsByTags(tags);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**List&lt;string&gt;**](string.md)| Tags to filter by |
### Return type
[**List<Pet>**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getpetbyid"></a>
# **GetPetById**
> Pet GetPetById (long? petId)
Find pet by ID
Returns a single pet
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class GetPetByIdExample
{
public void main()
{
// Configure API key authorization: api_key
Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
var apiInstance = new PetApi();
var petId = 789; // long? | ID of pet to return
try
{
// Find pet by ID
Pet result = apiInstance.GetPetById(petId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **long?**| ID of pet to return |
### Return type
[**Pet**](Pet.md)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updatepet"></a>
# **UpdatePet**
> void UpdatePet (Pet body)
Update an existing pet
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class UpdatePetExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
try
{
// Update an existing pet
apiInstance.UpdatePet(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updatepetwithform"></a>
# **UpdatePetWithForm**
> void UpdatePetWithForm (long? petId, string name = null, string status = null)
Updates a pet in the store with form data
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class UpdatePetWithFormExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var petId = 789; // long? | ID of pet that needs to be updated
var name = name_example; // string | Updated name of the pet (optional)
var status = status_example; // string | Updated status of the pet (optional)
try
{
// Updates a pet in the store with form data
apiInstance.UpdatePetWithForm(petId, name, status);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **long?**| ID of pet that needs to be updated |
**name** | **string**| Updated name of the pet | [optional]
**status** | **string**| Updated status of the pet | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="uploadfile"></a>
# **UploadFile**
> ApiResponse UploadFile (long? petId, string additionalMetadata = null, System.IO.Stream file = null)
uploads an image
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class UploadFileExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var petId = 789; // long? | ID of pet to update
var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional)
var file = new System.IO.Stream(); // System.IO.Stream | file to upload (optional)
try
{
// uploads an image
ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **long?**| ID of pet to update |
**additionalMetadata** | **string**| Additional data to pass to server | [optional]
**file** | **System.IO.Stream**| file to upload | [optional]
### Return type
[**ApiResponse**](ApiResponse.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.ReadOnlyFirst
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Bar** | **string** | | [optional]
**Baz** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,9 @@
# IO.Swagger.Model.SpecialModelName
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**SpecialPropertyName** | **long?** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,256 @@
# IO.Swagger.Api.StoreApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID
[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
<a name="deleteorder"></a>
# **DeleteOrder**
> void DeleteOrder (string orderId)
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class DeleteOrderExample
{
public void main()
{
var apiInstance = new StoreApi();
var orderId = orderId_example; // string | ID of the order that needs to be deleted
try
{
// Delete purchase order by ID
apiInstance.DeleteOrder(orderId);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **string**| ID of the order that needs to be deleted |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getinventory"></a>
# **GetInventory**
> Dictionary<string, int?> GetInventory ()
Returns pet inventories by status
Returns a map of status codes to quantities
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class GetInventoryExample
{
public void main()
{
// Configure API key authorization: api_key
Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
var apiInstance = new StoreApi();
try
{
// Returns pet inventories by status
Dictionary&lt;string, int?&gt; result = apiInstance.GetInventory();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message );
}
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
**Dictionary<string, int?>**
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getorderbyid"></a>
# **GetOrderById**
> Order GetOrderById (long? orderId)
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class GetOrderByIdExample
{
public void main()
{
var apiInstance = new StoreApi();
var orderId = 789; // long? | ID of pet that needs to be fetched
try
{
// Find purchase order by ID
Order result = apiInstance.GetOrderById(orderId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **long?**| ID of pet that needs to be fetched |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="placeorder"></a>
# **PlaceOrder**
> Order PlaceOrder (Order body)
Place an order for a pet
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class PlaceOrderExample
{
public void main()
{
var apiInstance = new StoreApi();
var body = new Order(); // Order | order placed for purchasing the pet
try
{
// Place an order for a pet
Order result = apiInstance.PlaceOrder(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# IO.Swagger.Model.Tag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Name** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,16 @@
# IO.Swagger.Model.User
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional]
**Username** | **string** | | [optional]
**FirstName** | **string** | | [optional]
**LastName** | **string** | | [optional]
**Email** | **string** | | [optional]
**Password** | **string** | | [optional]
**Phone** | **string** | | [optional]
**UserStatus** | **int?** | User Status | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,498 @@
# IO.Swagger.Api.UserApi
All URIs are relative to *http://petstore.swagger.io:80/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**CreateUser**](UserApi.md#createuser) | **POST** /user | Create user
[**CreateUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
[**CreateUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
[**DeleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
[**GetUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
[**LoginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
[**LogoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
[**UpdateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a name="createuser"></a>
# **CreateUser**
> void CreateUser (User body)
Create user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class CreateUserExample
{
public void main()
{
var apiInstance = new UserApi();
var body = new User(); // User | Created user object
try
{
// Create user
apiInstance.CreateUser(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md)| Created user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="createuserswitharrayinput"></a>
# **CreateUsersWithArrayInput**
> void CreateUsersWithArrayInput (List<User> body)
Creates list of users with given input array
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class CreateUsersWithArrayInputExample
{
public void main()
{
var apiInstance = new UserApi();
var body = new List<User>(); // List<User> | List of user object
try
{
// Creates list of users with given input array
apiInstance.CreateUsersWithArrayInput(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="createuserswithlistinput"></a>
# **CreateUsersWithListInput**
> void CreateUsersWithListInput (List<User> body)
Creates list of users with given input array
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class CreateUsersWithListInputExample
{
public void main()
{
var apiInstance = new UserApi();
var body = new List<User>(); // List<User> | List of user object
try
{
// Creates list of users with given input array
apiInstance.CreateUsersWithListInput(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List&lt;User&gt;**](User.md)| List of user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="deleteuser"></a>
# **DeleteUser**
> void DeleteUser (string username)
Delete user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class DeleteUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The name that needs to be deleted
try
{
// Delete user
apiInstance.DeleteUser(username);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The name that needs to be deleted |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getuserbyname"></a>
# **GetUserByName**
> User GetUserByName (string username)
Get user by user name
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class GetUserByNameExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The name that needs to be fetched. Use user1 for testing.
try
{
// Get user by user name
User result = apiInstance.GetUserByName(username);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
### Return type
[**User**](User.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="loginuser"></a>
# **LoginUser**
> string LoginUser (string username, string password)
Logs user into the system
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class LoginUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The user name for login
var password = password_example; // string | The password for login in clear text
try
{
// Logs user into the system
string result = apiInstance.LoginUser(username, password);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The user name for login |
**password** | **string**| The password for login in clear text |
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="logoutuser"></a>
# **LogoutUser**
> void LogoutUser ()
Logs out current logged in user session
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class LogoutUserExample
{
public void main()
{
var apiInstance = new UserApi();
try
{
// Logs out current logged in user session
apiInstance.LogoutUser();
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message );
}
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updateuser"></a>
# **UpdateUser**
> void UpdateUser (string username, User body)
Updated user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class UpdateUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | name that need to be deleted
var body = new User(); // User | Updated user object
try
{
// Updated user
apiInstance.UpdateUser(username, body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,52 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mozroots --import --sync
echo "[INFO] remove bin/Debug/SwaggerClientTest.dll"
rm src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll 2> /dev/null
echo "[INFO] install NUnit runners via NuGet"
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mozroots --import --sync
mono nuget.exe install src/IO.Swagger.Test/packages.config -o packages
echo "[INFO] Install NUnit runners via NuGet"
mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages
echo "[INFO] Build the solution and run the unit test"
xbuild IO.Swagger.sln && \
mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/IO.Swagger.Test/bin/Debug/IO.Swagger.Test.dll

View File

@ -0,0 +1,81 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using RestSharp;
using NUnit.Framework;
using IO.Swagger.Client;
using IO.Swagger.Api;
using IO.Swagger.Model;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing AnotherFakeApi
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the API endpoint.
/// </remarks>
[TestFixture]
public class AnotherFakeApiTests
{
private AnotherFakeApi instance;
/// <summary>
/// Setup before each unit test
/// </summary>
[SetUp]
public void Init()
{
instance = new AnotherFakeApi();
}
/// <summary>
/// Clean up after each unit test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of AnotherFakeApi
/// </summary>
[Test]
public void InstanceTest()
{
// TODO uncomment below to test 'IsInstanceOfType' AnotherFakeApi
//Assert.IsInstanceOfType(typeof(AnotherFakeApi), instance, "instance is a AnotherFakeApi");
}
/// <summary>
/// Test TestSpecialTags
/// </summary>
[Test]
public void TestSpecialTagsTest()
{
// TODO uncomment below to test the method and replace null with proper value
//ModelClient body = null;
//var response = instance.TestSpecialTags(body);
//Assert.IsInstanceOf<ModelClient> (response, "response is ModelClient");
}
}
}

View File

@ -0,0 +1,198 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using RestSharp;
using NUnit.Framework;
using IO.Swagger.Client;
using IO.Swagger.Api;
using IO.Swagger.Model;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing FakeApi
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the API endpoint.
/// </remarks>
[TestFixture]
public class FakeApiTests
{
private FakeApi instance;
/// <summary>
/// Setup before each unit test
/// </summary>
[SetUp]
public void Init()
{
instance = new FakeApi();
}
/// <summary>
/// Clean up after each unit test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of FakeApi
/// </summary>
[Test]
public void InstanceTest()
{
// TODO uncomment below to test 'IsInstanceOfType' FakeApi
//Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi");
}
/// <summary>
/// Test FakeOuterBooleanSerialize
/// </summary>
[Test]
public void FakeOuterBooleanSerializeTest()
{
// TODO uncomment below to test the method and replace null with proper value
//OuterBoolean body = null;
//var response = instance.FakeOuterBooleanSerialize(body);
//Assert.IsInstanceOf<OuterBoolean> (response, "response is OuterBoolean");
}
/// <summary>
/// Test FakeOuterCompositeSerialize
/// </summary>
[Test]
public void FakeOuterCompositeSerializeTest()
{
// TODO uncomment below to test the method and replace null with proper value
//OuterComposite body = null;
//var response = instance.FakeOuterCompositeSerialize(body);
//Assert.IsInstanceOf<OuterComposite> (response, "response is OuterComposite");
}
/// <summary>
/// Test FakeOuterNumberSerialize
/// </summary>
[Test]
public void FakeOuterNumberSerializeTest()
{
// TODO uncomment below to test the method and replace null with proper value
//OuterNumber body = null;
//var response = instance.FakeOuterNumberSerialize(body);
//Assert.IsInstanceOf<OuterNumber> (response, "response is OuterNumber");
}
/// <summary>
/// Test FakeOuterStringSerialize
/// </summary>
[Test]
public void FakeOuterStringSerializeTest()
{
// TODO uncomment below to test the method and replace null with proper value
//OuterString body = null;
//var response = instance.FakeOuterStringSerialize(body);
//Assert.IsInstanceOf<OuterString> (response, "response is OuterString");
}
/// <summary>
/// Test TestClientModel
/// </summary>
[Test]
public void TestClientModelTest()
{
// TODO uncomment below to test the method and replace null with proper value
//ModelClient body = null;
//var response = instance.TestClientModel(body);
//Assert.IsInstanceOf<ModelClient> (response, "response is ModelClient");
}
/// <summary>
/// Test TestEndpointParameters
/// </summary>
[Test]
public void TestEndpointParametersTest()
{
// TODO uncomment below to test the method and replace null with proper value
//decimal? number = null;
//double? _double = null;
//string patternWithoutDelimiter = null;
//byte[] _byte = null;
//int? integer = null;
//int? int32 = null;
//long? int64 = null;
//float? _float = null;
//string _string = null;
//byte[] binary = null;
//DateTime? date = null;
//DateTime? dateTime = null;
//string password = null;
//string callback = null;
//instance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback);
}
/// <summary>
/// Test TestEnumParameters
/// </summary>
[Test]
public void TestEnumParametersTest()
{
// TODO uncomment below to test the method and replace null with proper value
//List<string> enumFormStringArray = null;
//string enumFormString = null;
//List<string> enumHeaderStringArray = null;
//string enumHeaderString = null;
//List<string> enumQueryStringArray = null;
//string enumQueryString = null;
//int? enumQueryInteger = null;
//double? enumQueryDouble = null;
//instance.TestEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
}
/// <summary>
/// Test TestInlineAdditionalProperties
/// </summary>
[Test]
public void TestInlineAdditionalPropertiesTest()
{
// TODO uncomment below to test the method and replace null with proper value
//Object param = null;
//instance.TestInlineAdditionalProperties(param);
}
/// <summary>
/// Test TestJsonFormData
/// </summary>
[Test]
public void TestJsonFormDataTest()
{
// TODO uncomment below to test the method and replace null with proper value
//string param = null;
//string param2 = null;
//instance.TestJsonFormData(param, param2);
}
}
}

View File

@ -0,0 +1,81 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using RestSharp;
using NUnit.Framework;
using IO.Swagger.Client;
using IO.Swagger.Api;
using IO.Swagger.Model;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing FakeClassnameTags123Api
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the API endpoint.
/// </remarks>
[TestFixture]
public class FakeClassnameTags123ApiTests
{
private FakeClassnameTags123Api instance;
/// <summary>
/// Setup before each unit test
/// </summary>
[SetUp]
public void Init()
{
instance = new FakeClassnameTags123Api();
}
/// <summary>
/// Clean up after each unit test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of FakeClassnameTags123Api
/// </summary>
[Test]
public void InstanceTest()
{
// TODO uncomment below to test 'IsInstanceOfType' FakeClassnameTags123Api
//Assert.IsInstanceOfType(typeof(FakeClassnameTags123Api), instance, "instance is a FakeClassnameTags123Api");
}
/// <summary>
/// Test TestClassname
/// </summary>
[Test]
public void TestClassnameTest()
{
// TODO uncomment below to test the method and replace null with proper value
//ModelClient body = null;
//var response = instance.TestClassname(body);
//Assert.IsInstanceOf<ModelClient> (response, "response is ModelClient");
}
}
}

View File

@ -0,0 +1,170 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using RestSharp;
using NUnit.Framework;
using IO.Swagger.Client;
using IO.Swagger.Api;
using IO.Swagger.Model;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing PetApi
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the API endpoint.
/// </remarks>
[TestFixture]
public class PetApiTests
{
private PetApi instance;
/// <summary>
/// Setup before each unit test
/// </summary>
[SetUp]
public void Init()
{
instance = new PetApi();
}
/// <summary>
/// Clean up after each unit test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of PetApi
/// </summary>
[Test]
public void InstanceTest()
{
// TODO uncomment below to test 'IsInstanceOfType' PetApi
//Assert.IsInstanceOfType(typeof(PetApi), instance, "instance is a PetApi");
}
/// <summary>
/// Test AddPet
/// </summary>
[Test]
public void AddPetTest()
{
// TODO uncomment below to test the method and replace null with proper value
//Pet body = null;
//instance.AddPet(body);
}
/// <summary>
/// Test DeletePet
/// </summary>
[Test]
public void DeletePetTest()
{
// TODO uncomment below to test the method and replace null with proper value
//long? petId = null;
//string apiKey = null;
//instance.DeletePet(petId, apiKey);
}
/// <summary>
/// Test FindPetsByStatus
/// </summary>
[Test]
public void FindPetsByStatusTest()
{
// TODO uncomment below to test the method and replace null with proper value
//List<string> status = null;
//var response = instance.FindPetsByStatus(status);
//Assert.IsInstanceOf<List<Pet>> (response, "response is List<Pet>");
}
/// <summary>
/// Test FindPetsByTags
/// </summary>
[Test]
public void FindPetsByTagsTest()
{
// TODO uncomment below to test the method and replace null with proper value
//List<string> tags = null;
//var response = instance.FindPetsByTags(tags);
//Assert.IsInstanceOf<List<Pet>> (response, "response is List<Pet>");
}
/// <summary>
/// Test GetPetById
/// </summary>
[Test]
public void GetPetByIdTest()
{
// TODO uncomment below to test the method and replace null with proper value
//long? petId = null;
//var response = instance.GetPetById(petId);
//Assert.IsInstanceOf<Pet> (response, "response is Pet");
}
/// <summary>
/// Test UpdatePet
/// </summary>
[Test]
public void UpdatePetTest()
{
// TODO uncomment below to test the method and replace null with proper value
//Pet body = null;
//instance.UpdatePet(body);
}
/// <summary>
/// Test UpdatePetWithForm
/// </summary>
[Test]
public void UpdatePetWithFormTest()
{
// TODO uncomment below to test the method and replace null with proper value
//long? petId = null;
//string name = null;
//string status = null;
//instance.UpdatePetWithForm(petId, name, status);
}
/// <summary>
/// Test UploadFile
/// </summary>
[Test]
public void UploadFileTest()
{
// TODO uncomment below to test the method and replace null with proper value
//long? petId = null;
//string additionalMetadata = null;
//System.IO.Stream file = null;
//var response = instance.UploadFile(petId, additionalMetadata, file);
//Assert.IsInstanceOf<ApiResponse> (response, "response is ApiResponse");
}
}
}

View File

@ -0,0 +1,116 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using RestSharp;
using NUnit.Framework;
using IO.Swagger.Client;
using IO.Swagger.Api;
using IO.Swagger.Model;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing StoreApi
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the API endpoint.
/// </remarks>
[TestFixture]
public class StoreApiTests
{
private StoreApi instance;
/// <summary>
/// Setup before each unit test
/// </summary>
[SetUp]
public void Init()
{
instance = new StoreApi();
}
/// <summary>
/// Clean up after each unit test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of StoreApi
/// </summary>
[Test]
public void InstanceTest()
{
// TODO uncomment below to test 'IsInstanceOfType' StoreApi
//Assert.IsInstanceOfType(typeof(StoreApi), instance, "instance is a StoreApi");
}
/// <summary>
/// Test DeleteOrder
/// </summary>
[Test]
public void DeleteOrderTest()
{
// TODO uncomment below to test the method and replace null with proper value
//string orderId = null;
//instance.DeleteOrder(orderId);
}
/// <summary>
/// Test GetInventory
/// </summary>
[Test]
public void GetInventoryTest()
{
// TODO uncomment below to test the method and replace null with proper value
//var response = instance.GetInventory();
//Assert.IsInstanceOf<Dictionary<string, int?>> (response, "response is Dictionary<string, int?>");
}
/// <summary>
/// Test GetOrderById
/// </summary>
[Test]
public void GetOrderByIdTest()
{
// TODO uncomment below to test the method and replace null with proper value
//long? orderId = null;
//var response = instance.GetOrderById(orderId);
//Assert.IsInstanceOf<Order> (response, "response is Order");
}
/// <summary>
/// Test PlaceOrder
/// </summary>
[Test]
public void PlaceOrderTest()
{
// TODO uncomment below to test the method and replace null with proper value
//Order body = null;
//var response = instance.PlaceOrder(body);
//Assert.IsInstanceOf<Order> (response, "response is Order");
}
}
}

View File

@ -0,0 +1,166 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using RestSharp;
using NUnit.Framework;
using IO.Swagger.Client;
using IO.Swagger.Api;
using IO.Swagger.Model;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing UserApi
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the API endpoint.
/// </remarks>
[TestFixture]
public class UserApiTests
{
private UserApi instance;
/// <summary>
/// Setup before each unit test
/// </summary>
[SetUp]
public void Init()
{
instance = new UserApi();
}
/// <summary>
/// Clean up after each unit test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of UserApi
/// </summary>
[Test]
public void InstanceTest()
{
// TODO uncomment below to test 'IsInstanceOfType' UserApi
//Assert.IsInstanceOfType(typeof(UserApi), instance, "instance is a UserApi");
}
/// <summary>
/// Test CreateUser
/// </summary>
[Test]
public void CreateUserTest()
{
// TODO uncomment below to test the method and replace null with proper value
//User body = null;
//instance.CreateUser(body);
}
/// <summary>
/// Test CreateUsersWithArrayInput
/// </summary>
[Test]
public void CreateUsersWithArrayInputTest()
{
// TODO uncomment below to test the method and replace null with proper value
//List<User> body = null;
//instance.CreateUsersWithArrayInput(body);
}
/// <summary>
/// Test CreateUsersWithListInput
/// </summary>
[Test]
public void CreateUsersWithListInputTest()
{
// TODO uncomment below to test the method and replace null with proper value
//List<User> body = null;
//instance.CreateUsersWithListInput(body);
}
/// <summary>
/// Test DeleteUser
/// </summary>
[Test]
public void DeleteUserTest()
{
// TODO uncomment below to test the method and replace null with proper value
//string username = null;
//instance.DeleteUser(username);
}
/// <summary>
/// Test GetUserByName
/// </summary>
[Test]
public void GetUserByNameTest()
{
// TODO uncomment below to test the method and replace null with proper value
//string username = null;
//var response = instance.GetUserByName(username);
//Assert.IsInstanceOf<User> (response, "response is User");
}
/// <summary>
/// Test LoginUser
/// </summary>
[Test]
public void LoginUserTest()
{
// TODO uncomment below to test the method and replace null with proper value
//string username = null;
//string password = null;
//var response = instance.LoginUser(username, password);
//Assert.IsInstanceOf<string> (response, "response is string");
}
/// <summary>
/// Test LogoutUser
/// </summary>
[Test]
public void LogoutUserTest()
{
// TODO uncomment below to test the method and replace null with proper value
//instance.LogoutUser();
}
/// <summary>
/// Test UpdateUser
/// </summary>
[Test]
public void UpdateUserTest()
{
// TODO uncomment below to test the method and replace null with proper value
//string username = null;
//User body = null;
//instance.UpdateUser(username, body);
}
}
}

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Swagger Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
OpenAPI spec version: 1.0.0
Contact: apiteam@swagger.io
-->
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{19F1DEBC-DE5E-4517-8062-F000CD499087}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IO.Swagger.Test</RootNamespace>
<AssemblyName>IO.Swagger.Test</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
<Reference Include="Newtonsoft.Json">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RestSharp">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net40\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net40\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net40\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net40\RestSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="**\*.cs"
Exclude="obj\**"/>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\IO.Swagger\IO.Swagger.csproj">
<Project>{321C8C3F-0156-40C1-AE42-D59761FB9B6C}</Project>
<Name>IO.Swagger</Name>
</ProjectReference>
</ItemGroup>
</Project>

View File

@ -0,0 +1,88 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
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 IO.Swagger.Test
{
/// <summary>
/// Class for testing AdditionalPropertiesClass
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class AdditionalPropertiesClassTests
{
// TODO uncomment below to declare an instance variable for AdditionalPropertiesClass
//private AdditionalPropertiesClass instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of AdditionalPropertiesClass
//instance = new AdditionalPropertiesClass();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of AdditionalPropertiesClass
/// </summary>
[Test]
public void AdditionalPropertiesClassInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" AdditionalPropertiesClass
//Assert.IsInstanceOfType<AdditionalPropertiesClass> (instance, "variable 'instance' is a AdditionalPropertiesClass");
}
/// <summary>
/// Test the property 'MapProperty'
/// </summary>
[Test]
public void MapPropertyTest()
{
// TODO unit test for the property 'MapProperty'
}
/// <summary>
/// Test the property 'MapOfMapProperty'
/// </summary>
[Test]
public void MapOfMapPropertyTest()
{
// TODO unit test for the property 'MapOfMapProperty'
}
}
}

View File

@ -0,0 +1,72 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
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 IO.Swagger.Test
{
/// <summary>
/// Class for testing AnimalFarm
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class AnimalFarmTests
{
// TODO uncomment below to declare an instance variable for AnimalFarm
//private AnimalFarm instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of AnimalFarm
//instance = new AnimalFarm();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of AnimalFarm
/// </summary>
[Test]
public void AnimalFarmInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" AnimalFarm
//Assert.IsInstanceOfType<AnimalFarm> (instance, "variable 'instance' is a AnimalFarm");
}
}
}

View File

@ -0,0 +1,106 @@
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
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 IO.Swagger.Test
{
/// <summary>
/// Class for testing Animal
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class AnimalTests
{
// TODO uncomment below to declare an instance variable for Animal
//private Animal instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of Animal
//instance = new Animal();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of Animal
/// </summary>
[Test]
public void AnimalInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" Animal
//Assert.IsInstanceOfType<Animal> (instance, "variable 'instance' is a Animal");
}
/// <summary>
/// Test deserialize a Dog from type Animal
/// </summary>
[Test]
public void DogDeserializeFromAnimalTest()
{
// TODO uncomment below to test deserialize a Dog from type Animal
//Assert.IsInstanceOf<Animal>(JsonConvert.DeserializeObject<Animal>(new Dog().ToJson()));
}
/// <summary>
/// Test deserialize a Cat from type Animal
/// </summary>
[Test]
public void CatDeserializeFromAnimalTest()
{
// TODO uncomment below to test deserialize a Cat from type Animal
//Assert.IsInstanceOf<Animal>(JsonConvert.DeserializeObject<Animal>(new Cat().ToJson()));
}
/// <summary>
/// Test the property 'ClassName'
/// </summary>
[Test]
public void ClassNameTest()
{
// TODO unit test for the property 'ClassName'
}
/// <summary>
/// Test the property 'Color'
/// </summary>
[Test]
public void ColorTest()
{
// TODO unit test for the property 'Color'
}
}
}

Some files were not shown because too many files have changed in this diff Show More