mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 18:45:23 +00:00
Merge branch 'master' of https://github.com/swagger-api/swagger-codegen
This commit is contained in:
commit
17bbb25ce4
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# C# Petstore API client
|
||||
# C# Petstore API client (.NET 3.5)
|
||||
./bin/csharp-petstore.sh
|
||||
|
||||
# C# Petstore API client with PropertyChanged
|
||||
@ -8,3 +8,7 @@
|
||||
|
||||
# C# Petstore API client (v5.0 for .net standarnd 1.3+)
|
||||
./bin/csharp-petstore-net-standard.sh
|
||||
|
||||
# C# Petstore API client (.NET 4.0)
|
||||
./bin/csharp-petstore-net-40.sh
|
||||
|
||||
|
@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate $@ -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"
|
||||
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}"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate $@ -t modules/swagger-codegen/src/main/resources/nancyfx -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l nancyfx -o samples/server/petstore/nancyfx --additional-properties packageGuid={768B8DC6-54EE-4D40-9B20-7857E1D742A4}"
|
||||
ags="generate $@ -t modules/swagger-codegen/src/main/resources/nancyfx -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l nancyfx -o samples/server/petstore/nancyfx --additional-properties packageGuid={768B8DC6-54EE-4D40-9B20-7857E1D742A4},asyncServer=false"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
@ -10,7 +10,6 @@ machine:
|
||||
environment:
|
||||
DOCKER_GENERATOR_IMAGE_NAME: swaggerapi/swagger-generator
|
||||
DOCKER_CODEGEN_CLI_IMAGE_NAME: swaggerapi/swagger-codegen-cli
|
||||
DOCKER_BUILD_TAG: 2.2.3
|
||||
|
||||
dependencies:
|
||||
cache_directories:
|
||||
@ -46,7 +45,5 @@ test:
|
||||
- if [ $? -ne 0 ]; then exit 1; fi
|
||||
## docker: build generator image and push to Docker Hub
|
||||
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build --rm=false -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_GENERATOR_IMAGE_NAME; fi; fi
|
||||
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build --rm=false -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_GENERATOR_IMAGE_NAME:$DOCKER_BUILD_TAG; fi; fi
|
||||
## docker: build cli image and push to Docker Hub
|
||||
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build --rm=false -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/swagger-codegen-cli && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME; fi; fi
|
||||
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build --rm=false -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/swagger-codegen-cli && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME:$DOCKER_BUILD_TAG; fi; fi
|
||||
|
@ -183,6 +183,9 @@ public class CodegenConstants {
|
||||
public static final String SUPPORTS_ES6 = "supportsES6";
|
||||
public static final String SUPPORTS_ES6_DESC = "Generate code that conforms to ES6.";
|
||||
|
||||
public static final String SUPPORTS_ASYNC = "supportsAsync";
|
||||
public static final String SUPPORTS_ASYNC_DESC = "Generate code that supports async operations.";
|
||||
|
||||
public static final String EXCLUDE_TESTS = "excludeTests";
|
||||
public static final String EXCLUDE_TESTS_DESC = "Specifies that no tests are to be generated.";
|
||||
|
||||
@ -207,6 +210,9 @@ public class CodegenConstants {
|
||||
public static final String NON_PUBLIC_API = "nonPublicApi";
|
||||
public static final String NON_PUBLIC_API_DESC = "Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.";
|
||||
|
||||
public static final String VALIDATABLE = "validatable";
|
||||
public static final String VALIDATABLE_DESC = "Generates self-validatable models.";
|
||||
|
||||
public static final String IGNORE_FILE_OVERRIDE = "ignoreFileOverride";
|
||||
public static final String IGNORE_FILE_OVERRIDE_DESC = "Specifies an override location for the .swagger-codegen-ignore file. Most useful on initial generation.";
|
||||
|
||||
|
@ -263,24 +263,33 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// {{useDateTimeOffset}}
|
||||
if (additionalProperties.containsKey(CodegenConstants.USE_DATETIME_OFFSET)) {
|
||||
useDateTimeOffset(Boolean.valueOf(additionalProperties.get(CodegenConstants.USE_DATETIME_OFFSET).toString()));
|
||||
useDateTimeOffset(convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_DATETIME_OFFSET));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.USE_DATETIME_OFFSET, useDateTimeOffsetFlag);
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.USE_DATETIME_OFFSET, useDateTimeOffsetFlag);
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.USE_COLLECTION)) {
|
||||
setUseCollection(Boolean.valueOf(additionalProperties.get(CodegenConstants.USE_COLLECTION).toString()));
|
||||
setUseCollection(convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_COLLECTION));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.USE_COLLECTION, useCollection);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.RETURN_ICOLLECTION)) {
|
||||
setReturnICollection(Boolean.valueOf(additionalProperties.get(CodegenConstants.RETURN_ICOLLECTION).toString()));
|
||||
setReturnICollection(convertPropertyToBooleanAndWriteBack(CodegenConstants.RETURN_ICOLLECTION));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.RETURN_ICOLLECTION, returnICollection);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES)) {
|
||||
setOptionalEmitDefaultValue(Boolean.valueOf(additionalProperties.get(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES).toString()));
|
||||
setOptionalEmitDefaultValue(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES, optionalEmitDefaultValue);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.NETCORE_PROJECT_FILE)) {
|
||||
setNetCoreProjectFileFlag(Boolean.valueOf(additionalProperties.get(CodegenConstants.NETCORE_PROJECT_FILE).toString()));
|
||||
setNetCoreProjectFileFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.NETCORE_PROJECT_FILE));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.NETCORE_PROJECT_FILE, netCoreProjectFileFlag);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.INTERFACE_PREFIX)) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
@ -169,4 +170,10 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
// Converts, for example, PUT to HttpPut for controller attributes
|
||||
operation.httpMethod = "Http" + operation.httpMethod.substring(0, 1) + operation.httpMethod.substring(1).toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mustache.Compiler processCompiler(Mustache.Compiler compiler) {
|
||||
// To avoid unexpected behaviors when options are passed programmatically such as { "useCollection": "" }
|
||||
return super.processCompiler(compiler).emptyStringIsFalse(true);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.codegen.*;
|
||||
import io.swagger.models.Model;
|
||||
import org.slf4j.Logger;
|
||||
@ -17,21 +18,33 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
private static final String NET45 = "v4.5";
|
||||
private static final String NET40 = "v4.0";
|
||||
private static final String NET35 = "v3.5";
|
||||
// TODO: v5.0 is PCL, not netstandard version 1.3, and not a specific .NET Framework. This needs to be updated,
|
||||
// especially because it will conflict with .NET Framework 5.0 when released, and PCL 5 refers to Framework 4.0.
|
||||
// We should support either NETSTANDARD, PCL, or Both… but the concepts shouldn't be mixed.
|
||||
private static final String NETSTANDARD = "v5.0";
|
||||
private static final String UWP = "uwp";
|
||||
|
||||
// Defines the sdk option for targeted frameworks, which differs from targetFramework and targetFrameworkNuget
|
||||
private static final String MCS_NET_VERSION_KEY = "x-mcs-sdk";
|
||||
|
||||
protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase() + "}";
|
||||
protected String clientPackage = "IO.Swagger.Client";
|
||||
protected String localVariablePrefix = "";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
// Defines TargetFrameworkVersion in csproj files
|
||||
protected String targetFramework = NET45;
|
||||
|
||||
// Defines nuget identifiers for target framework
|
||||
protected String targetFrameworkNuget = "net45";
|
||||
protected boolean supportsAsync = Boolean.TRUE;
|
||||
protected boolean supportsUWP = Boolean.FALSE;
|
||||
protected boolean netStandard = Boolean.FALSE;
|
||||
protected boolean generatePropertyChanged = Boolean.FALSE;
|
||||
protected boolean hideGenerationTimestamp = Boolean.TRUE;
|
||||
|
||||
protected boolean validatable = Boolean.TRUE;
|
||||
protected Map<Character, String> regexModifiers;
|
||||
protected final Map<String, String> frameworks;
|
||||
|
||||
@ -145,6 +158,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
CodegenConstants.NETCORE_PROJECT_FILE_DESC,
|
||||
this.netCoreProjectFileFlag);
|
||||
|
||||
addSwitch(CodegenConstants.VALIDATABLE,
|
||||
CodegenConstants.VALIDATABLE_DESC,
|
||||
this.validatable);
|
||||
|
||||
regexModifiers = new HashMap<Character, String>();
|
||||
regexModifiers.put('i', "IgnoreCase");
|
||||
regexModifiers.put('m', "Multiline");
|
||||
@ -156,39 +173,43 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
/*
|
||||
* NOTE: When supporting boolean additionalProperties, you should read the value and write it back as a boolean.
|
||||
* This avoids oddities where additionalProperties contains "false" rather than false, which will cause the
|
||||
* templating engine to behave unexpectedly.
|
||||
*
|
||||
* Use the pattern:
|
||||
* if (additionalProperties.containsKey(prop)) convertPropertyToBooleanAndWriteBack(prop);
|
||||
*/
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.MODEL_PROPERTY_NAMING)) {
|
||||
setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING));
|
||||
}
|
||||
|
||||
// default HIDE_GENERATION_TIMESTAMP to true
|
||||
if (!additionalProperties.containsKey(CodegenConstants.HIDE_GENERATION_TIMESTAMP)) {
|
||||
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, Boolean.TRUE.toString());
|
||||
if (additionalProperties.containsKey(CodegenConstants.HIDE_GENERATION_TIMESTAMP)) {
|
||||
setHideGenerationTimestamp(convertPropertyToBooleanAndWriteBack(CodegenConstants.HIDE_GENERATION_TIMESTAMP));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP,
|
||||
Boolean.valueOf(additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP).toString()));
|
||||
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, hideGenerationTimestamp);
|
||||
}
|
||||
|
||||
if (isEmpty(apiPackage)) {
|
||||
apiPackage = "Api";
|
||||
setApiPackage("Api");
|
||||
}
|
||||
if (isEmpty(modelPackage)) {
|
||||
modelPackage = "Model";
|
||||
setModelPackage("Model");
|
||||
}
|
||||
clientPackage = "Client";
|
||||
|
||||
Boolean excludeTests = false;
|
||||
if (additionalProperties.containsKey(CodegenConstants.EXCLUDE_TESTS)) {
|
||||
excludeTests = Boolean.valueOf(additionalProperties.get(CodegenConstants.EXCLUDE_TESTS).toString());
|
||||
excludeTests = convertPropertyToBooleanAndWriteBack(CodegenConstants.EXCLUDE_TESTS);
|
||||
}
|
||||
|
||||
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
additionalProperties.put("clientPackage", clientPackage);
|
||||
additionalProperties.put("emitDefaultValue", optionalEmitDefaultValue);
|
||||
|
||||
if (!additionalProperties.containsKey("validatable")) {
|
||||
// default validatable to true if not set
|
||||
additionalProperties.put("validatable", true);
|
||||
if (additionalProperties.containsKey(CodegenConstants.VALIDATABLE)) {
|
||||
setValidatable(convertPropertyToBooleanAndWriteBack(CodegenConstants.VALIDATABLE));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.VALIDATABLE, validatable);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.DOTNET_FRAMEWORK)) {
|
||||
@ -196,93 +217,116 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
} else {
|
||||
// Ensure default is set.
|
||||
setTargetFramework(NET45);
|
||||
additionalProperties.put("targetFramework", this.targetFramework);
|
||||
additionalProperties.put(CodegenConstants.DOTNET_FRAMEWORK, this.targetFramework);
|
||||
}
|
||||
|
||||
if (NET35.equals(this.targetFramework)) {
|
||||
setTargetFrameworkNuget("net35");
|
||||
setSupportsAsync(Boolean.FALSE);
|
||||
if (additionalProperties.containsKey("supportsAsync")) {
|
||||
additionalProperties.remove("supportsAsync");
|
||||
}
|
||||
additionalProperties.put("validatable", false);
|
||||
// This is correct, mono will require you build .NET 3.5 sources using 4.0 SDK
|
||||
additionalProperties.put(MCS_NET_VERSION_KEY, "4");
|
||||
additionalProperties.put("net35", true);
|
||||
if (additionalProperties.containsKey(CodegenConstants.SUPPORTS_ASYNC)) {
|
||||
LOGGER.warn(".NET 3.5 generator does not support async.");
|
||||
additionalProperties.remove(CodegenConstants.SUPPORTS_ASYNC);
|
||||
}
|
||||
|
||||
setTargetFrameworkNuget("net35");
|
||||
setValidatable(Boolean.FALSE);
|
||||
setSupportsAsync(Boolean.FALSE);
|
||||
} else if (NETSTANDARD.equals(this.targetFramework)) {
|
||||
// TODO: NETSTANDARD here is misrepresenting a PCL v5.0 which supports .NET Framework 4.6+, .NET Core 1.0, and Windows Universal 10.0
|
||||
additionalProperties.put(MCS_NET_VERSION_KEY, "4.6-api");
|
||||
if (additionalProperties.containsKey("supportsUWP")) {
|
||||
LOGGER.warn(".NET " + NETSTANDARD + " generator does not support UWP.");
|
||||
additionalProperties.remove("supportsUWP");
|
||||
}
|
||||
|
||||
// TODO: NETSTANDARD=v5.0 and targetFrameworkNuget=netstandard1.3. These need to sync.
|
||||
setTargetFrameworkNuget("netstandard1.3");
|
||||
setSupportsAsync(Boolean.TRUE);
|
||||
setSupportsUWP(Boolean.FALSE);
|
||||
setNetStandard(Boolean.TRUE);
|
||||
additionalProperties.put("supportsAsync", this.supportsAsync);
|
||||
additionalProperties.put("supportsUWP", this.supportsUWP);
|
||||
additionalProperties.put("netStandard", this.netStandard);
|
||||
|
||||
//Tests not yet implemented for .NET Standard codegen
|
||||
//Todo implement it
|
||||
excludeTests = true;
|
||||
if (additionalProperties.containsKey(CodegenConstants.EXCLUDE_TESTS)) {
|
||||
additionalProperties.remove(CodegenConstants.EXCLUDE_TESTS);
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.EXCLUDE_TESTS, excludeTests);
|
||||
} else if (UWP.equals(this.targetFramework)) {
|
||||
setTargetFrameworkNuget("uwp");
|
||||
setSupportsAsync(Boolean.TRUE);
|
||||
setSupportsUWP(Boolean.TRUE);
|
||||
additionalProperties.put("supportsAsync", this.supportsAsync);
|
||||
additionalProperties.put("supportsUWP", this.supportsUWP);
|
||||
} else if (NET40.equals(this.targetFramework)) {
|
||||
additionalProperties.put(MCS_NET_VERSION_KEY, "4");
|
||||
additionalProperties.put("isNet40", true);
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SUPPORTS_ASYNC)) {
|
||||
LOGGER.warn(".NET " + NET40 + " generator does not support async.");
|
||||
additionalProperties.remove(CodegenConstants.SUPPORTS_ASYNC);
|
||||
}
|
||||
|
||||
setTargetFrameworkNuget("net40");
|
||||
setSupportsAsync(Boolean.FALSE);
|
||||
if (additionalProperties.containsKey("supportsAsync")) {
|
||||
additionalProperties.remove("supportsAsync");
|
||||
}
|
||||
additionalProperties.put("isNet40", true);
|
||||
} else {
|
||||
additionalProperties.put(MCS_NET_VERSION_KEY, "4.5.2-api");
|
||||
setTargetFrameworkNuget("net45");
|
||||
setSupportsAsync(Boolean.TRUE);
|
||||
additionalProperties.put("supportsAsync", this.supportsAsync);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.GENERATE_PROPERTY_CHANGED)) {
|
||||
if (NET35.equals(targetFramework)) {
|
||||
LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is only supported by generated code for .NET 4+.");
|
||||
additionalProperties.remove(CodegenConstants.GENERATE_PROPERTY_CHANGED);
|
||||
} else if (NETSTANDARD.equals(targetFramework)) {
|
||||
LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is not supported in .NET Standard generated code.");
|
||||
additionalProperties.remove(CodegenConstants.GENERATE_PROPERTY_CHANGED);
|
||||
} else if (Boolean.TRUE.equals(netCoreProjectFileFlag)) {
|
||||
LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is not supported in .NET Core csproj project format.");
|
||||
} else {
|
||||
setGeneratePropertyChanged(Boolean.valueOf(additionalProperties.get(CodegenConstants.GENERATE_PROPERTY_CHANGED).toString()));
|
||||
}
|
||||
|
||||
if (Boolean.FALSE.equals(this.generatePropertyChanged)) {
|
||||
additionalProperties.remove(CodegenConstants.GENERATE_PROPERTY_CHANGED);
|
||||
} else {
|
||||
setGeneratePropertyChanged(convertPropertyToBooleanAndWriteBack(CodegenConstants.GENERATE_PROPERTY_CHANGED));
|
||||
}
|
||||
}
|
||||
|
||||
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage);
|
||||
additionalProperties.put("clientPackage", clientPackage);
|
||||
|
||||
additionalProperties.put(CodegenConstants.EXCLUDE_TESTS, excludeTests);
|
||||
additionalProperties.put(CodegenConstants.VALIDATABLE, this.validatable);
|
||||
additionalProperties.put(CodegenConstants.SUPPORTS_ASYNC, this.supportsAsync);
|
||||
additionalProperties.put("supportsUWP", this.supportsUWP);
|
||||
additionalProperties.put("netStandard", this.netStandard);
|
||||
additionalProperties.put("targetFrameworkNuget", this.targetFrameworkNuget);
|
||||
|
||||
// TODO: either remove this and update templates to match the "optionalEmitDefaultValues" property, or rename that property.
|
||||
additionalProperties.put("emitDefaultValue", optionalEmitDefaultValue);
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_FILE)) {
|
||||
setOptionalProjectFileFlag(Boolean.valueOf(
|
||||
additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_FILE).toString()));
|
||||
setOptionalProjectFileFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_PROJECT_FILE));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.OPTIONAL_PROJECT_FILE, optionalProjectFileFlag);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_GUID)) {
|
||||
setPackageGuid((String) additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_GUID));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.OPTIONAL_PROJECT_GUID, packageGuid);
|
||||
}
|
||||
additionalProperties.put("packageGuid", packageGuid);
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_METHOD_ARGUMENT)) {
|
||||
setOptionalMethodArgumentFlag(Boolean.valueOf(additionalProperties
|
||||
.get(CodegenConstants.OPTIONAL_METHOD_ARGUMENT).toString()));
|
||||
setOptionalMethodArgumentFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_METHOD_ARGUMENT));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.OPTIONAL_METHOD_ARGUMENT, optionalMethodArgumentFlag);
|
||||
}
|
||||
additionalProperties.put("optionalMethodArgument", optionalMethodArgumentFlag);
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_ASSEMBLY_INFO)) {
|
||||
setOptionalAssemblyInfoFlag(Boolean.valueOf(additionalProperties
|
||||
.get(CodegenConstants.OPTIONAL_ASSEMBLY_INFO).toString()));
|
||||
setOptionalAssemblyInfoFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_ASSEMBLY_INFO));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.OPTIONAL_ASSEMBLY_INFO, optionalAssemblyInfoFlag);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.NON_PUBLIC_API)) {
|
||||
setNonPublicApi(Boolean.valueOf(additionalProperties.get(CodegenConstants.NON_PUBLIC_API).toString()));
|
||||
setNonPublicApi(convertPropertyToBooleanAndWriteBack(CodegenConstants.NON_PUBLIC_API));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.NON_PUBLIC_API, isNonPublicApi());
|
||||
}
|
||||
|
||||
final String testPackageName = testPackageName();
|
||||
@ -318,6 +362,12 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
supportingFiles.add(new SupportingFile("JsonSubTypes.mustache",
|
||||
clientPackageDir, "JsonSubTypes.cs"));
|
||||
|
||||
if (NET40.equals(this.targetFramework)) {
|
||||
// .net 4.0 doesn't include ReadOnlyDictionary…
|
||||
supportingFiles.add(new SupportingFile("ReadOnlyDictionary.mustache",
|
||||
clientPackageDir, "ReadOnlyDictionary.cs"));
|
||||
}
|
||||
|
||||
if (Boolean.FALSE.equals(this.netStandard) && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) {
|
||||
supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat"));
|
||||
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "build.sh"));
|
||||
@ -346,6 +396,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
if (Boolean.FALSE.equals(this.netCoreProjectFileFlag)) {
|
||||
supportingFiles.add(new SupportingFile("packages_test.config.mustache", testPackageFolder + File.separator, "packages.config"));
|
||||
}
|
||||
|
||||
if (NET40.equals(this.targetFramework)) {
|
||||
// Include minimal tests for modifications made to JsonSubTypes, since code is quite different for .net 4.0 from original implementation
|
||||
supportingFiles.add(new SupportingFile("JsonSubTypesTests.mustache",
|
||||
testPackageFolder + File.separator + "Client",
|
||||
"JsonSubTypesTests.cs"));
|
||||
}
|
||||
}
|
||||
|
||||
if (Boolean.TRUE.equals(generatePropertyChanged)) {
|
||||
@ -355,9 +412,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||
// apache v2 license
|
||||
// UPDATE (20160612) no longer needed as the Apache v2 LICENSE is added globally
|
||||
//supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
|
||||
|
||||
if (optionalAssemblyInfoFlag && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) {
|
||||
supportingFiles.add(new SupportingFile("AssemblyInfo.mustache", packageFolder + File.separator + "Properties", "AssemblyInfo.cs"));
|
||||
@ -727,6 +781,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
this.generatePropertyChanged = generatePropertyChanged;
|
||||
}
|
||||
|
||||
public void setHideGenerationTimestamp(boolean hideGenerationTimestamp) {
|
||||
this.hideGenerationTimestamp = hideGenerationTimestamp;
|
||||
}
|
||||
|
||||
public boolean isNonPublicApi() {
|
||||
return nonPublicApi;
|
||||
}
|
||||
@ -735,6 +793,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
this.nonPublicApi = nonPublicApi;
|
||||
}
|
||||
|
||||
public void setValidatable(boolean validatable) {
|
||||
this.validatable = validatable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelDocFilename(String name) {
|
||||
return toModelFilename(name);
|
||||
@ -759,4 +821,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
public String modelTestFileFolder() {
|
||||
return outputFolder + File.separator + testFolder + File.separator + testPackageName() + File.separator + modelPackage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mustache.Compiler processCompiler(Mustache.Compiler compiler) {
|
||||
// To avoid unexpected behaviors when options are passed programmatically such as { "supportsAsync": "" }
|
||||
return super.processCompiler(compiler).emptyStringIsFalse(true);
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
|
||||
addSwitch(RETURN_ICOLLECTION, RETURN_ICOLLECTION_DESC, returnICollection);
|
||||
addSwitch(IMMUTABLE_OPTION, "Enabled by default. If disabled generates model classes with setters", true);
|
||||
addSwitch(USE_BASE_PATH, "Enabled by default. If disabled, module paths will not mirror api base path", true);
|
||||
addSwitch(ASYNC_SERVER, "Set to true to enable the generation of async routes/endpoints.", false);
|
||||
addSwitch(ASYNC_SERVER, "Set to true to enable the generation of async routes/endpoints.", this.asyncServer);
|
||||
typeMapping.putAll(nodaTimeTypesMappings());
|
||||
languageSpecificPrimitives.addAll(nodaTimePrimitiveTypes());
|
||||
|
||||
@ -134,7 +134,9 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(ASYNC_SERVER)) {
|
||||
setAsyncServer(Boolean.valueOf(additionalProperties.get(ASYNC_SERVER).toString()));
|
||||
setAsyncServer(convertPropertyToBooleanAndWriteBack(ASYNC_SERVER));
|
||||
} else {
|
||||
additionalProperties.put(ASYNC_SERVER, this.asyncServer);
|
||||
}
|
||||
|
||||
additionalProperties.put("packageGuid", packageGuid);
|
||||
|
@ -61,6 +61,7 @@ public class ApiClient {
|
||||
protected String basePath = "{{{basePath}}}";
|
||||
protected boolean debugging = false;
|
||||
protected int connectionTimeout = 0;
|
||||
private int readTimeout = 0;
|
||||
|
||||
protected Client httpClient;
|
||||
protected JSON json;
|
||||
|
@ -132,7 +132,7 @@ namespace JsonSubTypes
|
||||
private static IList CreateCompatibleList(Type targetContainerType, Type elementType)
|
||||
{
|
||||
IList list;
|
||||
if (targetContainerType.IsArray || targetContainerType.GetTypeInfo().IsAbstract)
|
||||
if (targetContainerType.IsArray || targetContainerType{{^isNet40}}.GetTypeInfo(){{/isNet40}}.IsAbstract)
|
||||
{
|
||||
list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType));
|
||||
}
|
||||
@ -152,7 +152,7 @@ namespace JsonSubTypes
|
||||
}
|
||||
else
|
||||
{
|
||||
elementType = arrayOrGenericContainer.GenericTypeArguments[0];
|
||||
elementType = arrayOrGenericContainer{{#isNet40}}.GetGenericArguments().FirstOrDefault(){{/isNet40}}{{^isNet40}}.GenericTypeArguments[0]{{/isNet40}};
|
||||
}
|
||||
return elementType;
|
||||
}
|
||||
@ -190,7 +190,7 @@ namespace JsonSubTypes
|
||||
|
||||
private static Type GetTypeByPropertyPresence(JObject jObject, Type parentType)
|
||||
{
|
||||
foreach (var type in parentType.GetTypeInfo().GetCustomAttributes<KnownSubTypeWithPropertyAttribute>())
|
||||
foreach (var type in parentType{{#isNet40}}.GetCustomAttributes(false).OfType{{/isNet40}}{{^isNet40}}.GetTypeInfo().GetCustomAttributes{{/isNet40}}<KnownSubTypeWithPropertyAttribute>())
|
||||
{
|
||||
JToken ignore;
|
||||
if (jObject.TryGetValue(type.PropertyName, out ignore))
|
||||
@ -222,7 +222,7 @@ namespace JsonSubTypes
|
||||
if (typeName == null)
|
||||
return null;
|
||||
|
||||
var insideAssembly = parentType.GetTypeInfo().Assembly;
|
||||
var insideAssembly = parentType{{^isNet40}}.GetTypeInfo(){{/isNet40}}.Assembly;
|
||||
|
||||
var typeByName = insideAssembly.GetType(typeName);
|
||||
if (typeByName == null)
|
||||
@ -233,7 +233,7 @@ namespace JsonSubTypes
|
||||
return typeByName;
|
||||
}
|
||||
|
||||
private static Type GetTypeFromMapping(IReadOnlyDictionary<object, Type> typeMapping, object discriminatorValue)
|
||||
private static Type GetTypeFromMapping(I{{^isNet40}}ReadOnly{{/isNet40}}Dictionary<object, Type> typeMapping, object discriminatorValue)
|
||||
{
|
||||
var targetlookupValueType = typeMapping.First().Key.GetType();
|
||||
var lookupValue = ConvertJsonValueToType(discriminatorValue, targetlookupValueType);
|
||||
@ -244,12 +244,12 @@ namespace JsonSubTypes
|
||||
|
||||
private static Dictionary<object, Type> GetSubTypeMapping(Type type)
|
||||
{
|
||||
return type.GetTypeInfo().GetCustomAttributes<KnownSubTypeAttribute>().ToDictionary(x => x.AssociatedValue, x => x.SubType);
|
||||
return type{{#isNet40}}.GetCustomAttributes(false).OfType{{/isNet40}}{{^isNet40}}.GetTypeInfo().GetCustomAttributes{{/isNet40}}<KnownSubTypeAttribute>().ToDictionary(x => x.AssociatedValue, x => x.SubType);
|
||||
}
|
||||
|
||||
private static object ConvertJsonValueToType(object objectType, Type targetlookupValueType)
|
||||
{
|
||||
if (targetlookupValueType.GetTypeInfo().IsEnum)
|
||||
if (targetlookupValueType{{^isNet40}}.GetTypeInfo(){{/isNet40}}.IsEnum)
|
||||
return Enum.ToObject(targetlookupValueType, objectType);
|
||||
|
||||
return Convert.ChangeType(objectType, targetlookupValueType);
|
||||
|
@ -0,0 +1,125 @@
|
||||
{{>partial_header}}
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JsonSubTypes;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
|
||||
using {{packageName}}.{{apiPackage}};
|
||||
using {{packageName}}.{{modelPackage}};
|
||||
using {{packageName}}.Client;
|
||||
|
||||
namespace {{packageName}}.Test.Client
|
||||
{
|
||||
public class JsonSubTypesTests
|
||||
{
|
||||
[Test]
|
||||
public void TestSimpleJsonSubTypesExample()
|
||||
{
|
||||
var annimal =
|
||||
JsonConvert.DeserializeObject<IAnimal>("{\"Kind\":\"Dog\",\"Breed\":\"Jack Russell Terrier\"}");
|
||||
Assert.AreEqual("Jack Russell Terrier", (annimal as Dog)?.Breed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeserializeObjectWithCustomMapping()
|
||||
{
|
||||
var annimal =
|
||||
JsonConvert.DeserializeObject<Animal2>("{\"Sound\":\"Bark\",\"Breed\":\"Jack Russell Terrier\"}");
|
||||
Assert.AreEqual("Jack Russell Terrier", (annimal as Dog2)?.Breed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeserializeObjectMappingByPropertyPresence()
|
||||
{
|
||||
string json =
|
||||
"[{\"Department\":\"Department1\",\"JobTitle\":\"JobTitle1\",\"FirstName\":\"FirstName1\",\"LastName\":\"LastName1\"}," +
|
||||
"{\"Department\":\"Department1\",\"JobTitle\":\"JobTitle1\",\"FirstName\":\"FirstName1\",\"LastName\":\"LastName1\"}," +
|
||||
"{\"Skill\":\"Painter\",\"FirstName\":\"FirstName1\",\"LastName\":\"LastName1\"}]";
|
||||
|
||||
|
||||
var persons = JsonConvert.DeserializeObject<ICollection<Person>>(json);
|
||||
Assert.AreEqual("Painter", (persons.Last() as Artist)?.Skill);
|
||||
}
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(JsonSubtypes), "Kind")]
|
||||
public interface IAnimal
|
||||
{
|
||||
string Kind { get; }
|
||||
}
|
||||
|
||||
public class Dog : IAnimal
|
||||
{
|
||||
public Dog()
|
||||
{
|
||||
Kind = "Dog";
|
||||
}
|
||||
|
||||
public string Kind { get; }
|
||||
public string Breed { get; set; }
|
||||
}
|
||||
|
||||
class Cat : IAnimal
|
||||
{
|
||||
public Cat()
|
||||
{
|
||||
Kind = "Cat";
|
||||
}
|
||||
|
||||
public string Kind { get; }
|
||||
bool Declawed { get; set; }
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(JsonSubtypes), "Sound")]
|
||||
[JsonSubtypes.KnownSubType(typeof(Dog2), "Bark")]
|
||||
[JsonSubtypes.KnownSubType(typeof(Cat2), "Meow")]
|
||||
public class Animal2
|
||||
{
|
||||
public virtual string Sound { get; }
|
||||
public string Color { get; set; }
|
||||
}
|
||||
|
||||
public class Dog2 : Animal2
|
||||
{
|
||||
public Dog2()
|
||||
{
|
||||
Sound = "Bark";
|
||||
}
|
||||
|
||||
public override string Sound { get; }
|
||||
public string Breed { get; set; }
|
||||
}
|
||||
|
||||
public class Cat2 : Animal2
|
||||
{
|
||||
public Cat2()
|
||||
{
|
||||
Sound = "Meow";
|
||||
}
|
||||
|
||||
public override string Sound { get; }
|
||||
public bool Declawed { get; set; }
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(JsonSubtypes))]
|
||||
[JsonSubtypes.KnownSubTypeWithProperty(typeof(Employee), "JobTitle")]
|
||||
[JsonSubtypes.KnownSubTypeWithProperty(typeof(Artist), "Skill")]
|
||||
public class Person
|
||||
{
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
}
|
||||
|
||||
public class Employee : Person
|
||||
{
|
||||
public string Department { get; set; }
|
||||
public string JobTitle { get; set; }
|
||||
}
|
||||
|
||||
public class Artist : Person
|
||||
{
|
||||
public string Skill { get; set; }
|
||||
}
|
||||
}
|
@ -73,10 +73,10 @@
|
||||
<HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
{{#generatePropertyChanged}}
|
||||
<Reference Include="PropertyChanged">
|
||||
|
@ -0,0 +1,137 @@
|
||||
{{>partial_header}}
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace {{packageName}}.Client
|
||||
{
|
||||
public class ReadOnlyDictionary<T, K> : IDictionary<T, K>
|
||||
{
|
||||
private IDictionary<T, K> _dictionaryImplementation;
|
||||
public IEnumerator<KeyValuePair<T, K>> GetEnumerator()
|
||||
{
|
||||
return _dictionaryImplementation.GetEnumerator();
|
||||
}
|
||||
|
||||
public ReadOnlyDictionary()
|
||||
{
|
||||
_dictionaryImplementation = new Dictionary<T, K>();
|
||||
}
|
||||
|
||||
public ReadOnlyDictionary(IDictionary<T, K> dictionaryImplementation)
|
||||
{
|
||||
if (dictionaryImplementation == null) throw new ArgumentNullException("dictionaryImplementation");
|
||||
_dictionaryImplementation = dictionaryImplementation;
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return ((IEnumerable) _dictionaryImplementation).GetEnumerator();
|
||||
}
|
||||
|
||||
public void Add(KeyValuePair<T, K> item)
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
}
|
||||
|
||||
public bool Contains(KeyValuePair<T, K> item)
|
||||
{
|
||||
return _dictionaryImplementation.Contains(item);
|
||||
}
|
||||
|
||||
public void CopyTo(KeyValuePair<T, K>[] array, int arrayIndex)
|
||||
{
|
||||
_dictionaryImplementation.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public bool Remove(KeyValuePair<T, K> item)
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return _dictionaryImplementation.Count; }
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Add(T key, K value)
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
}
|
||||
|
||||
public bool ContainsKey(T key)
|
||||
{
|
||||
return _dictionaryImplementation.ContainsKey(key);
|
||||
}
|
||||
|
||||
public bool Remove(T key)
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
}
|
||||
|
||||
public bool TryGetValue(T key, out K value)
|
||||
{
|
||||
return _dictionaryImplementation.TryGetValue(key, out value);
|
||||
}
|
||||
|
||||
public K this[T key]
|
||||
{
|
||||
get { return _dictionaryImplementation[key]; }
|
||||
set
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<T> Keys
|
||||
{
|
||||
get { return _dictionaryImplementation.Keys; }
|
||||
}
|
||||
|
||||
public ICollection<K> Values
|
||||
{
|
||||
get { return _dictionaryImplementation.Values; }
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ReadonlyOperationException : Exception
|
||||
{
|
||||
//
|
||||
// For guidelines regarding the creation of new exception types, see
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
|
||||
// and
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
|
||||
//
|
||||
|
||||
public ReadonlyOperationException()
|
||||
{
|
||||
}
|
||||
|
||||
public ReadonlyOperationException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public ReadonlyOperationException(string message, Exception inner) : base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
protected ReadonlyOperationException(
|
||||
SerializationInfo info,
|
||||
StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -65,10 +65,10 @@
|
||||
<HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\RestSharp.105.1.0\lib\{{targetFrameworkNuget}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('{{binRelativePath}}')">{{binRelativePath}}\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
|
@ -4,18 +4,47 @@
|
||||
#
|
||||
|
||||
frameworkVersion={{targetFrameworkNuget}}
|
||||
netfx=${frameworkVersion#net}
|
||||
|
||||
# sdk must match installed framworks under PREFIX/lib/mono/[value]
|
||||
sdk={{x-mcs-sdk}}
|
||||
|
||||
# langversion refers to C# language features. see man mcs for details.
|
||||
langversion=${sdk}
|
||||
nuget_cmd=nuget
|
||||
|
||||
# Match against our known SDK possibilities
|
||||
case "${sdk}" in
|
||||
4)
|
||||
langversion=4
|
||||
;;
|
||||
4.5*)
|
||||
langversion=5
|
||||
;;
|
||||
4.6*)
|
||||
langversion=6
|
||||
;;
|
||||
4.7*)
|
||||
langversion=7 # ignoring 7.1 for now.
|
||||
;;
|
||||
*)
|
||||
langversion=6
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "[INFO] Target framework: ${frameworkVersion}"
|
||||
|
||||
echo "[INFO] Download nuget and packages"
|
||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
|
||||
if [ ! type nuget &>/dev/null ]; then
|
||||
echo "[INFO] Download nuget and packages"
|
||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
|
||||
nuget_cmd="mono nuget"
|
||||
fi
|
||||
|
||||
mozroots --import --sync
|
||||
mono nuget.exe install src/{{packageName}}/packages.config -o packages;
|
||||
${nuget_cmd} install src/{{packageName}}/packages.config -o packages;
|
||||
|
||||
echo "[INFO] Copy DLLs to the 'bin' folder"
|
||||
mkdir -p bin;
|
||||
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/Newtonsoft.Json.10.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
|
||||
cp packages/RestSharp.105.1.0/lib/{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}/RestSharp.dll bin/RestSharp.dll;
|
||||
{{#generatePropertyChanged}}
|
||||
cp packages/Fody.1.29.4/Fody.dll bin/Fody.dll
|
||||
@ -24,7 +53,7 @@ cp packages/PropertyChanged.Fody.1.51.3/Lib/dotnet/PropertyChanged.dll bin/Prope
|
||||
{{/generatePropertyChanged}}
|
||||
|
||||
echo "[INFO] Run 'mcs' to build bin/{{{packageName}}}.dll"
|
||||
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
|
||||
mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,\
|
||||
{{#generatePropertyChanged}}
|
||||
bin/Fody.dll,\
|
||||
bin/PropertyChanged.Fody.dll,\
|
||||
|
@ -6,6 +6,7 @@
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
./nuget
|
||||
|
||||
# Build results
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="{{#isNet40}}4.5.11{{/isNet40}}{{^isNet40}}10.0.3{{/isNet40}}" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
<package id="RestSharp" version="105.1.0" targetFramework="{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
{{#generatePropertyChanged}}
|
||||
<package id="Fody" version="1.29.4" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
<package id="PropertyChanged.Fody" version="1.51.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="{{targetFrameworkNuget}}" />
|
||||
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="{{#isNet40}}4.5.11{{/isNet40}}{{^isNet40}}10.0.3{{/isNet40}}" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
<package id="RestSharp" version="105.1.0" targetFramework="{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
|
||||
</packages>
|
||||
|
@ -63,7 +63,7 @@ class ObjectSerializer {
|
||||
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
||||
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
||||
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
||||
let transformedData = [];
|
||||
let transformedData: any[] = [];
|
||||
for (let index in data) {
|
||||
let date = data[index];
|
||||
transformedData.push(ObjectSerializer.serialize(date, subType));
|
||||
@ -81,7 +81,7 @@ class ObjectSerializer {
|
||||
|
||||
// get the map for the correct type.
|
||||
let attributeTypes = typeMap[type].getAttributeTypeMap();
|
||||
let instance = {};
|
||||
let instance: {[index: string]: any} = {};
|
||||
for (let index in attributeTypes) {
|
||||
let attributeType = attributeTypes[index];
|
||||
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
|
||||
@ -100,7 +100,7 @@ class ObjectSerializer {
|
||||
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
||||
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
||||
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
||||
let transformedData = [];
|
||||
let transformedData: any[] = [];
|
||||
for (let index in data) {
|
||||
let date = data[index];
|
||||
transformedData.push(ObjectSerializer.deserialize(date, subType));
|
||||
@ -190,7 +190,7 @@ export namespace {{classname}} {
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
|
||||
let enumsMap = {
|
||||
let enumsMap: {[index: string]: any} = {
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#hasEnums}}
|
||||
@ -204,7 +204,7 @@ let enumsMap = {
|
||||
{{/models}}
|
||||
}
|
||||
|
||||
let typeMap = {
|
||||
let typeMap: {[index: string]: any} = {
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
"{{classname}}": {{classname}},
|
||||
@ -339,7 +339,7 @@ export class {{classname}} {
|
||||
}
|
||||
|
||||
public setApiKey(key: {{classname}}ApiKeys, value: string) {
|
||||
this.authentications[{{classname}}ApiKeys[key]].apiKey = value;
|
||||
(this.authentications as any)[{{classname}}ApiKeys[key]].apiKey = value;
|
||||
}
|
||||
{{#authMethods}}
|
||||
{{#isBasic}}
|
||||
|
@ -4,6 +4,7 @@
|
||||
"noImplicitAny": false,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}",
|
||||
"strict": true,
|
||||
"moduleResolution": "node",
|
||||
"removeComments": true,
|
||||
"sourceMap": true,
|
||||
@ -15,4 +16,3 @@
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,8 @@ public class CSharpClientOptionsTest extends AbstractOptionsTest {
|
||||
times = 1;
|
||||
clientCodegen.setModelPropertyNaming(CSharpClientOptionsProvider.MODEL_PROPERTY_NAMING);
|
||||
times = 1;
|
||||
clientCodegen.setValidatable(true);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public class CSharpClientOptionsProvider implements OptionsProvider {
|
||||
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
|
||||
.put(CodegenConstants.NETCORE_PROJECT_FILE, "false")
|
||||
.put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING)
|
||||
.put(CodegenConstants.VALIDATABLE, "true")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ class ObjectSerializer {
|
||||
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
||||
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
||||
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
||||
let transformedData = [];
|
||||
let transformedData: any[] = [];
|
||||
for (let index in data) {
|
||||
let date = data[index];
|
||||
transformedData.push(ObjectSerializer.serialize(date, subType));
|
||||
@ -90,7 +90,7 @@ class ObjectSerializer {
|
||||
|
||||
// get the map for the correct type.
|
||||
let attributeTypes = typeMap[type].getAttributeTypeMap();
|
||||
let instance = {};
|
||||
let instance: {[index: string]: any} = {};
|
||||
for (let index in attributeTypes) {
|
||||
let attributeType = attributeTypes[index];
|
||||
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
|
||||
@ -109,7 +109,7 @@ class ObjectSerializer {
|
||||
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
||||
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
||||
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
||||
let transformedData = [];
|
||||
let transformedData: any[] = [];
|
||||
for (let index in data) {
|
||||
let date = data[index];
|
||||
transformedData.push(ObjectSerializer.deserialize(date, subType));
|
||||
@ -160,10 +160,10 @@ export class ModelReturn {
|
||||
}
|
||||
|
||||
|
||||
let enumsMap = {
|
||||
let enumsMap: {[index: string]: any} = {
|
||||
}
|
||||
|
||||
let typeMap = {
|
||||
let typeMap: {[index: string]: any} = {
|
||||
"ModelReturn": ModelReturn,
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ export class FakeApi {
|
||||
}
|
||||
|
||||
public setApiKey(key: FakeApiApiKeys, value: string) {
|
||||
this.authentications[FakeApiApiKeys[key]].apiKey = value;
|
||||
(this.authentications as any)[FakeApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
||||
set accessToken(token: string) {
|
||||
|
@ -36,7 +36,7 @@ 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."
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential 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
|
||||
|
@ -6,6 +6,7 @@
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
./nuget
|
||||
|
||||
# Build results
|
||||
|
||||
|
@ -102,6 +102,7 @@ Class | Method | HTTP request | Description
|
||||
*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
|
||||
|
@ -4,14 +4,43 @@
|
||||
#
|
||||
|
||||
frameworkVersion=net45
|
||||
netfx=${frameworkVersion#net}
|
||||
|
||||
# sdk must match installed framworks under PREFIX/lib/mono/[value]
|
||||
sdk=4.5.2-api
|
||||
|
||||
# langversion refers to C# language features. see man mcs for details.
|
||||
langversion=${sdk}
|
||||
nuget_cmd=nuget
|
||||
|
||||
# Match against our known SDK possibilities
|
||||
case "${sdk}" in
|
||||
4)
|
||||
langversion=4
|
||||
;;
|
||||
4.5*)
|
||||
langversion=5
|
||||
;;
|
||||
4.6*)
|
||||
langversion=6
|
||||
;;
|
||||
4.7*)
|
||||
langversion=7 # ignoring 7.1 for now.
|
||||
;;
|
||||
*)
|
||||
langversion=6
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "[INFO] Target framework: ${frameworkVersion}"
|
||||
|
||||
echo "[INFO] Download nuget and packages"
|
||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
|
||||
if [ ! type nuget &>/dev/null ]; then
|
||||
echo "[INFO] Download nuget and packages"
|
||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
|
||||
nuget_cmd="mono nuget"
|
||||
fi
|
||||
|
||||
mozroots --import --sync
|
||||
mono nuget.exe install src/IO.Swagger/packages.config -o packages;
|
||||
${nuget_cmd} install src/IO.Swagger/packages.config -o packages;
|
||||
|
||||
echo "[INFO] Copy DLLs to the 'bin' folder"
|
||||
mkdir -p bin;
|
||||
@ -19,7 +48,7 @@ cp packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.
|
||||
cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll;
|
||||
|
||||
echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll"
|
||||
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
|
||||
mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,\
|
||||
bin/RestSharp.dll,\
|
||||
System.ComponentModel.DataAnnotations.dll,\
|
||||
System.Runtime.Serialization.dll \
|
||||
|
@ -11,6 +11,7 @@ Method | HTTP request | Description
|
||||
[**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" 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
|
||||
|
||||
|
||||
@ -342,10 +343,10 @@ namespace Example
|
||||
Configuration.Default.Password = "YOUR_PASSWORD";
|
||||
|
||||
var apiInstance = new FakeApi();
|
||||
var number = 3.4; // decimal? | None
|
||||
var number = 8.14; // decimal? | None
|
||||
var _double = 1.2; // double? | None
|
||||
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
|
||||
var _byte = _byte_example; // byte[] | None
|
||||
var _byte = B; // byte[] | None
|
||||
var integer = 56; // int? | None (optional)
|
||||
var int32 = 56; // int? | None (optional)
|
||||
var int64 = 789; // long? | None (optional)
|
||||
@ -479,14 +480,70 @@ No authorization required
|
||||
|
||||
[[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;
|
||||
|
@ -20,8 +20,6 @@ Method | HTTP request | Description
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -83,8 +81,6 @@ void (empty response body)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -342,8 +338,6 @@ Name | Type | Description | Notes
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -405,8 +399,6 @@ void (empty response body)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -472,8 +464,6 @@ void (empty response body)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -199,8 +199,6 @@ No authorization required
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -80,8 +80,6 @@ No authorization required
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -140,8 +138,6 @@ No authorization required
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -260,8 +256,6 @@ No authorization required
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -321,8 +315,6 @@ No authorization required
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -384,8 +376,6 @@ No authorization required
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -212,6 +212,27 @@ namespace IO.Swagger.Api
|
||||
/// <returns>ApiResponse of Object(void)</returns>
|
||||
ApiResponse<Object> TestEnumParametersWithHttpInfo (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);
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns></returns>
|
||||
void TestInlineAdditionalProperties (Object param);
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>ApiResponse of Object(void)</returns>
|
||||
ApiResponse<Object> TestInlineAdditionalPropertiesWithHttpInfo (Object param);
|
||||
/// <summary>
|
||||
/// test json serialization of form data
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@ -424,6 +445,27 @@ namespace IO.Swagger.Api
|
||||
/// <returns>Task of ApiResponse</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (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);
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of void</returns>
|
||||
System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync (Object param);
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of ApiResponse</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<Object>> TestInlineAdditionalPropertiesAsyncWithHttpInfo (Object param);
|
||||
/// <summary>
|
||||
/// test json serialization of form data
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@ -1665,6 +1707,151 @@ namespace IO.Swagger.Api
|
||||
null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns></returns>
|
||||
public void TestInlineAdditionalProperties (Object param)
|
||||
{
|
||||
TestInlineAdditionalPropertiesWithHttpInfo(param);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>ApiResponse of Object(void)</returns>
|
||||
public ApiResponse<Object> TestInlineAdditionalPropertiesWithHttpInfo (Object param)
|
||||
{
|
||||
// verify the required parameter 'param' is set
|
||||
if (param == null)
|
||||
throw new ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestInlineAdditionalProperties");
|
||||
|
||||
var localVarPath = "/fake/inline-additionalProperties";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (param != null && param.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(param); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = param; // byte array
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath,
|
||||
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestInlineAdditionalProperties", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<Object>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||
null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of void</returns>
|
||||
public async System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync (Object param)
|
||||
{
|
||||
await TestInlineAdditionalPropertiesAsyncWithHttpInfo(param);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of ApiResponse</returns>
|
||||
public async System.Threading.Tasks.Task<ApiResponse<Object>> TestInlineAdditionalPropertiesAsyncWithHttpInfo (Object param)
|
||||
{
|
||||
// verify the required parameter 'param' is set
|
||||
if (param == null)
|
||||
throw new ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestInlineAdditionalProperties");
|
||||
|
||||
var localVarPath = "/fake/inline-additionalProperties";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (param != null && param.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(param); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = param; // byte array
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
|
||||
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestInlineAdditionalProperties", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<Object>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||
null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test json serialization of form data
|
||||
/// </summary>
|
||||
|
@ -139,7 +139,7 @@ namespace IO.Swagger.Client
|
||||
|
||||
if (postBody != null) // http body (model or byte[]) parameter
|
||||
{
|
||||
request.AddParameter(contentType, postBody, ParameterType.RequestBody);
|
||||
request.AddParameter(contentType, postBody, ParameterType.RequestBody);
|
||||
}
|
||||
|
||||
return request;
|
||||
@ -347,18 +347,18 @@ namespace IO.Swagger.Client
|
||||
/// <summary>
|
||||
///Check if the given MIME is a JSON MIME.
|
||||
///JSON MIME examples:
|
||||
/// application/json
|
||||
/// application/json
|
||||
/// application/json; charset=UTF8
|
||||
/// APPLICATION/JSON
|
||||
/// application/vnd.company+json
|
||||
/// </summary>
|
||||
/// <param name="mime">MIME</param>
|
||||
/// <returns>Returns True if MIME type is json.</returns>
|
||||
/// <returns>Returns True if MIME type is json.</returns>
|
||||
public bool IsJsonMime(String mime)
|
||||
{
|
||||
var jsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||
return mime != null && (jsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json", StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
return mime != null && (jsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select the Content-Type header's value from the given content-type array:
|
||||
@ -374,7 +374,7 @@ namespace IO.Swagger.Client
|
||||
|
||||
foreach (var contentType in contentTypes)
|
||||
{
|
||||
if (IsJsonMime(contentType))
|
||||
if (IsJsonMime(contentType.ToLower()))
|
||||
return contentType;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
./nuget
|
||||
|
||||
# Build results
|
||||
|
||||
|
@ -4,22 +4,51 @@
|
||||
#
|
||||
|
||||
frameworkVersion=net40
|
||||
netfx=${frameworkVersion#net}
|
||||
|
||||
# sdk must match installed framworks under PREFIX/lib/mono/[value]
|
||||
sdk=4
|
||||
|
||||
# langversion refers to C# language features. see man mcs for details.
|
||||
langversion=${sdk}
|
||||
nuget_cmd=nuget
|
||||
|
||||
# Match against our known SDK possibilities
|
||||
case "${sdk}" in
|
||||
4)
|
||||
langversion=4
|
||||
;;
|
||||
4.5*)
|
||||
langversion=5
|
||||
;;
|
||||
4.6*)
|
||||
langversion=6
|
||||
;;
|
||||
4.7*)
|
||||
langversion=7 # ignoring 7.1 for now.
|
||||
;;
|
||||
*)
|
||||
langversion=6
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "[INFO] Target framework: ${frameworkVersion}"
|
||||
|
||||
echo "[INFO] Download nuget and packages"
|
||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
|
||||
if [ ! type nuget &>/dev/null ]; then
|
||||
echo "[INFO] Download nuget and packages"
|
||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
|
||||
nuget_cmd="mono nuget"
|
||||
fi
|
||||
|
||||
mozroots --import --sync
|
||||
mono nuget.exe install src/IO.Swagger/packages.config -o packages;
|
||||
${nuget_cmd} 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/Newtonsoft.Json.10.0.3/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,\
|
||||
mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,\
|
||||
bin/RestSharp.dll,\
|
||||
System.ComponentModel.DataAnnotations.dll,\
|
||||
System.Runtime.Serialization.dll \
|
||||
|
@ -343,10 +343,10 @@ namespace Example
|
||||
Configuration.Default.Password = "YOUR_PASSWORD";
|
||||
|
||||
var apiInstance = new FakeApi();
|
||||
var number = 3.4; // decimal? | None
|
||||
var number = 8.14; // decimal? | None
|
||||
var _double = 1.2; // double? | None
|
||||
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
|
||||
var _byte = _byte_example; // byte[] | None
|
||||
var _byte = B; // byte[] | None
|
||||
var integer = 56; // int? | None (optional)
|
||||
var int32 = 56; // int? | None (optional)
|
||||
var int64 = 789; // long? | None (optional)
|
||||
@ -486,8 +486,6 @@ No authorization required
|
||||
|
||||
test inline additionalProperties
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -546,8 +544,6 @@ No authorization required
|
||||
|
||||
test json serialization of form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -20,8 +20,6 @@ Method | HTTP request | Description
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -83,8 +81,6 @@ void (empty response body)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -342,8 +338,6 @@ Name | Type | Description | Notes
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -405,8 +399,6 @@ void (empty response body)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -472,8 +464,6 @@ void (empty response body)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -199,8 +199,6 @@ No authorization required
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -80,8 +80,6 @@ No authorization required
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -140,8 +138,6 @@ No authorization required
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -260,8 +256,6 @@ No authorization required
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -321,8 +315,6 @@ No authorization required
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -384,8 +376,6 @@ No authorization required
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
Binary file not shown.
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JsonSubTypes;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
|
||||
using IO.Swagger.Api;
|
||||
using IO.Swagger.Model;
|
||||
using IO.Swagger.Client;
|
||||
|
||||
namespace IO.Swagger.Test.Client
|
||||
{
|
||||
public class JsonSubTypesTests
|
||||
{
|
||||
[Test]
|
||||
public void TestSimpleJsonSubTypesExample()
|
||||
{
|
||||
var annimal =
|
||||
JsonConvert.DeserializeObject<IAnimal>("{\"Kind\":\"Dog\",\"Breed\":\"Jack Russell Terrier\"}");
|
||||
Assert.AreEqual("Jack Russell Terrier", (annimal as Dog)?.Breed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeserializeObjectWithCustomMapping()
|
||||
{
|
||||
var annimal =
|
||||
JsonConvert.DeserializeObject<Animal2>("{\"Sound\":\"Bark\",\"Breed\":\"Jack Russell Terrier\"}");
|
||||
Assert.AreEqual("Jack Russell Terrier", (annimal as Dog2)?.Breed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeserializeObjectMappingByPropertyPresence()
|
||||
{
|
||||
string json =
|
||||
"[{\"Department\":\"Department1\",\"JobTitle\":\"JobTitle1\",\"FirstName\":\"FirstName1\",\"LastName\":\"LastName1\"}," +
|
||||
"{\"Department\":\"Department1\",\"JobTitle\":\"JobTitle1\",\"FirstName\":\"FirstName1\",\"LastName\":\"LastName1\"}," +
|
||||
"{\"Skill\":\"Painter\",\"FirstName\":\"FirstName1\",\"LastName\":\"LastName1\"}]";
|
||||
|
||||
|
||||
var persons = JsonConvert.DeserializeObject<ICollection<Person>>(json);
|
||||
Assert.AreEqual("Painter", (persons.Last() as Artist)?.Skill);
|
||||
}
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(JsonSubtypes), "Kind")]
|
||||
public interface IAnimal
|
||||
{
|
||||
string Kind { get; }
|
||||
}
|
||||
|
||||
public class Dog : IAnimal
|
||||
{
|
||||
public Dog()
|
||||
{
|
||||
Kind = "Dog";
|
||||
}
|
||||
|
||||
public string Kind { get; }
|
||||
public string Breed { get; set; }
|
||||
}
|
||||
|
||||
class Cat : IAnimal
|
||||
{
|
||||
public Cat()
|
||||
{
|
||||
Kind = "Cat";
|
||||
}
|
||||
|
||||
public string Kind { get; }
|
||||
bool Declawed { get; set; }
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(JsonSubtypes), "Sound")]
|
||||
[JsonSubtypes.KnownSubType(typeof(Dog2), "Bark")]
|
||||
[JsonSubtypes.KnownSubType(typeof(Cat2), "Meow")]
|
||||
public class Animal2
|
||||
{
|
||||
public virtual string Sound { get; }
|
||||
public string Color { get; set; }
|
||||
}
|
||||
|
||||
public class Dog2 : Animal2
|
||||
{
|
||||
public Dog2()
|
||||
{
|
||||
Sound = "Bark";
|
||||
}
|
||||
|
||||
public override string Sound { get; }
|
||||
public string Breed { get; set; }
|
||||
}
|
||||
|
||||
public class Cat2 : Animal2
|
||||
{
|
||||
public Cat2()
|
||||
{
|
||||
Sound = "Meow";
|
||||
}
|
||||
|
||||
public override string Sound { get; }
|
||||
public bool Declawed { get; set; }
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(JsonSubtypes))]
|
||||
[JsonSubtypes.KnownSubTypeWithProperty(typeof(Employee), "JobTitle")]
|
||||
[JsonSubtypes.KnownSubTypeWithProperty(typeof(Artist), "Skill")]
|
||||
public class Person
|
||||
{
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
}
|
||||
|
||||
public class Employee : Person
|
||||
{
|
||||
public string Department { get; set; }
|
||||
public string JobTitle { get; set; }
|
||||
}
|
||||
|
||||
public class Artist : Person
|
||||
{
|
||||
public string Skill { get; set; }
|
||||
}
|
||||
}
|
@ -53,10 +53,10 @@ Contact: apiteam@swagger.io
|
||||
<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>
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net4\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net40" />
|
||||
<package id="RestSharp" version="105.1.0" targetFramework="net40" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" developmentDependency="true" />
|
||||
<package id="RestSharp" version="105.1.0" targetFramework="net4" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net40" developmentDependency="true" />
|
||||
</packages>
|
||||
|
@ -132,7 +132,7 @@ namespace JsonSubTypes
|
||||
private static IList CreateCompatibleList(Type targetContainerType, Type elementType)
|
||||
{
|
||||
IList list;
|
||||
if (targetContainerType.IsArray || targetContainerType.GetTypeInfo().IsAbstract)
|
||||
if (targetContainerType.IsArray || targetContainerType.IsAbstract)
|
||||
{
|
||||
list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType));
|
||||
}
|
||||
@ -152,7 +152,7 @@ namespace JsonSubTypes
|
||||
}
|
||||
else
|
||||
{
|
||||
elementType = arrayOrGenericContainer.GenericTypeArguments[0];
|
||||
elementType = arrayOrGenericContainer.GetGenericArguments().FirstOrDefault();
|
||||
}
|
||||
return elementType;
|
||||
}
|
||||
@ -190,7 +190,7 @@ namespace JsonSubTypes
|
||||
|
||||
private static Type GetTypeByPropertyPresence(JObject jObject, Type parentType)
|
||||
{
|
||||
foreach (var type in parentType.GetTypeInfo().GetCustomAttributes<KnownSubTypeWithPropertyAttribute>())
|
||||
foreach (var type in parentType.GetCustomAttributes(false).OfType<KnownSubTypeWithPropertyAttribute>())
|
||||
{
|
||||
JToken ignore;
|
||||
if (jObject.TryGetValue(type.PropertyName, out ignore))
|
||||
@ -222,7 +222,7 @@ namespace JsonSubTypes
|
||||
if (typeName == null)
|
||||
return null;
|
||||
|
||||
var insideAssembly = parentType.GetTypeInfo().Assembly;
|
||||
var insideAssembly = parentType.Assembly;
|
||||
|
||||
var typeByName = insideAssembly.GetType(typeName);
|
||||
if (typeByName == null)
|
||||
@ -233,7 +233,7 @@ namespace JsonSubTypes
|
||||
return typeByName;
|
||||
}
|
||||
|
||||
private static Type GetTypeFromMapping(IReadOnlyDictionary<object, Type> typeMapping, object discriminatorValue)
|
||||
private static Type GetTypeFromMapping(IDictionary<object, Type> typeMapping, object discriminatorValue)
|
||||
{
|
||||
var targetlookupValueType = typeMapping.First().Key.GetType();
|
||||
var lookupValue = ConvertJsonValueToType(discriminatorValue, targetlookupValueType);
|
||||
@ -244,12 +244,12 @@ namespace JsonSubTypes
|
||||
|
||||
private static Dictionary<object, Type> GetSubTypeMapping(Type type)
|
||||
{
|
||||
return type.GetTypeInfo().GetCustomAttributes<KnownSubTypeAttribute>().ToDictionary(x => x.AssociatedValue, x => x.SubType);
|
||||
return type.GetCustomAttributes(false).OfType<KnownSubTypeAttribute>().ToDictionary(x => x.AssociatedValue, x => x.SubType);
|
||||
}
|
||||
|
||||
private static object ConvertJsonValueToType(object objectType, Type targetlookupValueType)
|
||||
{
|
||||
if (targetlookupValueType.GetTypeInfo().IsEnum)
|
||||
if (targetlookupValueType.IsEnum)
|
||||
return Enum.ToObject(targetlookupValueType, objectType);
|
||||
|
||||
return Convert.ChangeType(objectType, targetlookupValueType);
|
||||
|
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* 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.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace IO.Swagger.Client
|
||||
{
|
||||
public class ReadOnlyDictionary<T, K> : IDictionary<T, K>
|
||||
{
|
||||
private IDictionary<T, K> _dictionaryImplementation;
|
||||
public IEnumerator<KeyValuePair<T, K>> GetEnumerator()
|
||||
{
|
||||
return _dictionaryImplementation.GetEnumerator();
|
||||
}
|
||||
|
||||
public ReadOnlyDictionary()
|
||||
{
|
||||
_dictionaryImplementation = new Dictionary<T, K>();
|
||||
}
|
||||
|
||||
public ReadOnlyDictionary(IDictionary<T, K> dictionaryImplementation)
|
||||
{
|
||||
if (dictionaryImplementation == null) throw new ArgumentNullException("dictionaryImplementation");
|
||||
_dictionaryImplementation = dictionaryImplementation;
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return ((IEnumerable) _dictionaryImplementation).GetEnumerator();
|
||||
}
|
||||
|
||||
public void Add(KeyValuePair<T, K> item)
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
}
|
||||
|
||||
public bool Contains(KeyValuePair<T, K> item)
|
||||
{
|
||||
return _dictionaryImplementation.Contains(item);
|
||||
}
|
||||
|
||||
public void CopyTo(KeyValuePair<T, K>[] array, int arrayIndex)
|
||||
{
|
||||
_dictionaryImplementation.CopyTo(array, arrayIndex);
|
||||
}
|
||||
|
||||
public bool Remove(KeyValuePair<T, K> item)
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return _dictionaryImplementation.Count; }
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Add(T key, K value)
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
}
|
||||
|
||||
public bool ContainsKey(T key)
|
||||
{
|
||||
return _dictionaryImplementation.ContainsKey(key);
|
||||
}
|
||||
|
||||
public bool Remove(T key)
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
}
|
||||
|
||||
public bool TryGetValue(T key, out K value)
|
||||
{
|
||||
return _dictionaryImplementation.TryGetValue(key, out value);
|
||||
}
|
||||
|
||||
public K this[T key]
|
||||
{
|
||||
get { return _dictionaryImplementation[key]; }
|
||||
set
|
||||
{
|
||||
throw new ReadonlyOperationException("This instance is readonly.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<T> Keys
|
||||
{
|
||||
get { return _dictionaryImplementation.Keys; }
|
||||
}
|
||||
|
||||
public ICollection<K> Values
|
||||
{
|
||||
get { return _dictionaryImplementation.Values; }
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ReadonlyOperationException : Exception
|
||||
{
|
||||
//
|
||||
// For guidelines regarding the creation of new exception types, see
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
|
||||
// and
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
|
||||
//
|
||||
|
||||
public ReadonlyOperationException()
|
||||
{
|
||||
}
|
||||
|
||||
public ReadonlyOperationException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public ReadonlyOperationException(string message, Exception inner) : base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
protected ReadonlyOperationException(
|
||||
SerializationInfo info,
|
||||
StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -54,10 +54,10 @@ Contact: apiteam@swagger.io
|
||||
<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>
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net4\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="RestSharp" version="105.1.0" targetFramework="net40" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" developmentDependency="true" />
|
||||
<package id="RestSharp" version="105.1.0" targetFramework="net4" developmentDependency="true" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net40" developmentDependency="true" />
|
||||
</packages>
|
||||
|
@ -6,6 +6,7 @@
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
./nuget
|
||||
|
||||
# Build results
|
||||
|
||||
|
@ -48,17 +48,18 @@ namespace Example
|
||||
public void main()
|
||||
{
|
||||
|
||||
var apiInstance = new FakeApi();
|
||||
var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional)
|
||||
var apiInstance = new AnotherFakeApi();
|
||||
var body = new ModelClient(); // ModelClient | client model
|
||||
|
||||
try
|
||||
{
|
||||
OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body);
|
||||
// To test special tags
|
||||
ModelClient result = apiInstance.TestSpecialTags(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message );
|
||||
Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message );
|
||||
}
|
||||
|
||||
}
|
||||
@ -73,6 +74,7 @@ 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 |
|
||||
@ -80,8 +82,9 @@ Class | Method | HTTP request | Description
|
||||
*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
|
||||
*Fake_classname_tags123Api* | [**TestClassname**](docs/Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||
*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
|
||||
|
@ -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)
|
||||
|
@ -11,6 +11,7 @@ Method | HTTP request | Description
|
||||
[**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" 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
|
||||
|
||||
|
||||
@ -342,10 +343,10 @@ namespace Example
|
||||
Configuration.Default.Password = "YOUR_PASSWORD";
|
||||
|
||||
var apiInstance = new FakeApi();
|
||||
var number = 3.4; // decimal? | None
|
||||
var number = 8.14; // decimal? | None
|
||||
var _double = 1.2; // double? | None
|
||||
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
|
||||
var _byte = _byte_example; // byte[] | None
|
||||
var _byte = B; // byte[] | None
|
||||
var integer = 56; // int? | None (optional)
|
||||
var int32 = 56; // int? | None (optional)
|
||||
var int64 = 789; // long? | None (optional)
|
||||
@ -479,14 +480,70 @@ No authorization required
|
||||
|
||||
[[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;
|
||||
|
@ -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)
|
||||
|
@ -20,8 +20,6 @@ Method | HTTP request | Description
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -83,8 +81,6 @@ void (empty response body)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -342,8 +338,6 @@ Name | Type | Description | Notes
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -405,8 +399,6 @@ void (empty response body)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -472,8 +464,6 @@ void (empty response body)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -199,8 +199,6 @@ No authorization required
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -80,8 +80,6 @@ No authorization required
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -140,8 +138,6 @@ No authorization required
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -260,8 +256,6 @@ No authorization required
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -321,8 +315,6 @@ No authorization required
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -384,8 +376,6 @@ No authorization required
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -0,0 +1,321 @@
|
||||
/*
|
||||
* 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.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using RestSharp.Portable;
|
||||
using IO.Swagger.Client;
|
||||
using IO.Swagger.Model;
|
||||
|
||||
namespace IO.Swagger.Api
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
public interface IAnotherFakeApi : IApiAccessor
|
||||
{
|
||||
#region Synchronous Operations
|
||||
/// <summary>
|
||||
/// To test special tags
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To test special tags
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ModelClient</returns>
|
||||
ModelClient TestSpecialTags (ModelClient body);
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To test special tags
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ApiResponse of ModelClient</returns>
|
||||
ApiResponse<ModelClient> TestSpecialTagsWithHttpInfo (ModelClient body);
|
||||
#endregion Synchronous Operations
|
||||
#region Asynchronous Operations
|
||||
/// <summary>
|
||||
/// To test special tags
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To test special tags
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ModelClient</returns>
|
||||
System.Threading.Tasks.Task<ModelClient> TestSpecialTagsAsync (ModelClient body);
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To test special tags
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ApiResponse (ModelClient)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestSpecialTagsAsyncWithHttpInfo (ModelClient body);
|
||||
#endregion Asynchronous Operations
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
public partial class AnotherFakeApi : IAnotherFakeApi
|
||||
{
|
||||
private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public AnotherFakeApi(String basePath)
|
||||
{
|
||||
this.Configuration = new Configuration { BasePath = basePath };
|
||||
|
||||
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class
|
||||
/// using Configuration object
|
||||
/// </summary>
|
||||
/// <param name="configuration">An instance of Configuration</param>
|
||||
/// <returns></returns>
|
||||
public AnotherFakeApi(Configuration configuration = null)
|
||||
{
|
||||
if (configuration == null) // use the default one in Configuration
|
||||
this.Configuration = Configuration.Default;
|
||||
else
|
||||
this.Configuration = configuration;
|
||||
|
||||
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base path of the API client.
|
||||
/// </summary>
|
||||
/// <value>The base path</value>
|
||||
public String GetBasePath()
|
||||
{
|
||||
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the base path of the API client.
|
||||
/// </summary>
|
||||
/// <value>The base path</value>
|
||||
[Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
|
||||
public void SetBasePath(String basePath)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the configuration object
|
||||
/// </summary>
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a factory method hook for the creation of exceptions.
|
||||
/// </summary>
|
||||
public IO.Swagger.Client.ExceptionFactory ExceptionFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
|
||||
{
|
||||
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
|
||||
}
|
||||
return _exceptionFactory;
|
||||
}
|
||||
set { _exceptionFactory = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default header.
|
||||
/// </summary>
|
||||
/// <returns>Dictionary of HTTP header</returns>
|
||||
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
|
||||
public IDictionary<String, String> DefaultHeader()
|
||||
{
|
||||
return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add default header.
|
||||
/// </summary>
|
||||
/// <param name="key">Header field name.</param>
|
||||
/// <param name="value">Header field value.</param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
|
||||
public void AddDefaultHeader(string key, string value)
|
||||
{
|
||||
this.Configuration.AddDefaultHeader(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags To test special tags
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ModelClient</returns>
|
||||
public ModelClient TestSpecialTags (ModelClient body)
|
||||
{
|
||||
ApiResponse<ModelClient> localVarResponse = TestSpecialTagsWithHttpInfo(body);
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags To test special tags
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ApiResponse of ModelClient</returns>
|
||||
public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient body)
|
||||
{
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null)
|
||||
throw new ApiException(400, "Missing required parameter 'body' when calling AnotherFakeApi->TestSpecialTags");
|
||||
|
||||
var localVarPath = "./another-fake/dummy";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (body != null && body.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = body; // byte array
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath,
|
||||
Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<ModelClient>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
|
||||
(ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags To test special tags
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ModelClient</returns>
|
||||
public async System.Threading.Tasks.Task<ModelClient> TestSpecialTagsAsync (ModelClient body)
|
||||
{
|
||||
ApiResponse<ModelClient> localVarResponse = await TestSpecialTagsAsyncWithHttpInfo(body);
|
||||
return localVarResponse.Data;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags To test special tags
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ApiResponse (ModelClient)</returns>
|
||||
public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestSpecialTagsAsyncWithHttpInfo (ModelClient body)
|
||||
{
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null)
|
||||
throw new ApiException(400, "Missing required parameter 'body' when calling AnotherFakeApi->TestSpecialTags");
|
||||
|
||||
var localVarPath = "./another-fake/dummy";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (body != null && body.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = body; // byte array
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
|
||||
Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<ModelClient>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
|
||||
(ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -212,6 +212,27 @@ namespace IO.Swagger.Api
|
||||
/// <returns>ApiResponse of Object(void)</returns>
|
||||
ApiResponse<Object> TestEnumParametersWithHttpInfo (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);
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns></returns>
|
||||
void TestInlineAdditionalProperties (Object param);
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>ApiResponse of Object(void)</returns>
|
||||
ApiResponse<Object> TestInlineAdditionalPropertiesWithHttpInfo (Object param);
|
||||
/// <summary>
|
||||
/// test json serialization of form data
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@ -424,6 +445,27 @@ namespace IO.Swagger.Api
|
||||
/// <returns>Task of ApiResponse</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (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);
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of void</returns>
|
||||
System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync (Object param);
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of ApiResponse</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<Object>> TestInlineAdditionalPropertiesAsyncWithHttpInfo (Object param);
|
||||
/// <summary>
|
||||
/// test json serialization of form data
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@ -1665,6 +1707,151 @@ namespace IO.Swagger.Api
|
||||
null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns></returns>
|
||||
public void TestInlineAdditionalProperties (Object param)
|
||||
{
|
||||
TestInlineAdditionalPropertiesWithHttpInfo(param);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>ApiResponse of Object(void)</returns>
|
||||
public ApiResponse<Object> TestInlineAdditionalPropertiesWithHttpInfo (Object param)
|
||||
{
|
||||
// verify the required parameter 'param' is set
|
||||
if (param == null)
|
||||
throw new ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestInlineAdditionalProperties");
|
||||
|
||||
var localVarPath = "./fake/inline-additionalProperties";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (param != null && param.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(param); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = param; // byte array
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath,
|
||||
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestInlineAdditionalProperties", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<Object>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
|
||||
null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of void</returns>
|
||||
public async System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync (Object param)
|
||||
{
|
||||
await TestInlineAdditionalPropertiesAsyncWithHttpInfo(param);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of ApiResponse</returns>
|
||||
public async System.Threading.Tasks.Task<ApiResponse<Object>> TestInlineAdditionalPropertiesAsyncWithHttpInfo (Object param)
|
||||
{
|
||||
// verify the required parameter 'param' is set
|
||||
if (param == null)
|
||||
throw new ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestInlineAdditionalProperties");
|
||||
|
||||
var localVarPath = "./fake/inline-additionalProperties";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (param != null && param.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(param); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = param; // byte array
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
|
||||
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestInlineAdditionalProperties", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<Object>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
|
||||
null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test json serialization of form data
|
||||
/// </summary>
|
||||
|
@ -0,0 +1,331 @@
|
||||
/*
|
||||
* 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.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using RestSharp.Portable;
|
||||
using IO.Swagger.Client;
|
||||
using IO.Swagger.Model;
|
||||
|
||||
namespace IO.Swagger.Api
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
public interface IFakeClassnameTags123Api : IApiAccessor
|
||||
{
|
||||
#region Synchronous Operations
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ModelClient</returns>
|
||||
ModelClient TestClassname (ModelClient body);
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ApiResponse of ModelClient</returns>
|
||||
ApiResponse<ModelClient> TestClassnameWithHttpInfo (ModelClient body);
|
||||
#endregion Synchronous Operations
|
||||
#region Asynchronous Operations
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ModelClient</returns>
|
||||
System.Threading.Tasks.Task<ModelClient> TestClassnameAsync (ModelClient body);
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ApiResponse (ModelClient)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClassnameAsyncWithHttpInfo (ModelClient body);
|
||||
#endregion Asynchronous Operations
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
public partial class FakeClassnameTags123Api : IFakeClassnameTags123Api
|
||||
{
|
||||
private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public FakeClassnameTags123Api(String basePath)
|
||||
{
|
||||
this.Configuration = new Configuration { BasePath = basePath };
|
||||
|
||||
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class
|
||||
/// using Configuration object
|
||||
/// </summary>
|
||||
/// <param name="configuration">An instance of Configuration</param>
|
||||
/// <returns></returns>
|
||||
public FakeClassnameTags123Api(Configuration configuration = null)
|
||||
{
|
||||
if (configuration == null) // use the default one in Configuration
|
||||
this.Configuration = Configuration.Default;
|
||||
else
|
||||
this.Configuration = configuration;
|
||||
|
||||
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base path of the API client.
|
||||
/// </summary>
|
||||
/// <value>The base path</value>
|
||||
public String GetBasePath()
|
||||
{
|
||||
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the base path of the API client.
|
||||
/// </summary>
|
||||
/// <value>The base path</value>
|
||||
[Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
|
||||
public void SetBasePath(String basePath)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the configuration object
|
||||
/// </summary>
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a factory method hook for the creation of exceptions.
|
||||
/// </summary>
|
||||
public IO.Swagger.Client.ExceptionFactory ExceptionFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
|
||||
{
|
||||
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
|
||||
}
|
||||
return _exceptionFactory;
|
||||
}
|
||||
set { _exceptionFactory = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default header.
|
||||
/// </summary>
|
||||
/// <returns>Dictionary of HTTP header</returns>
|
||||
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
|
||||
public IDictionary<String, String> DefaultHeader()
|
||||
{
|
||||
return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add default header.
|
||||
/// </summary>
|
||||
/// <param name="key">Header field name.</param>
|
||||
/// <param name="value">Header field value.</param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
|
||||
public void AddDefaultHeader(string key, string value)
|
||||
{
|
||||
this.Configuration.AddDefaultHeader(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ModelClient</returns>
|
||||
public ModelClient TestClassname (ModelClient body)
|
||||
{
|
||||
ApiResponse<ModelClient> localVarResponse = TestClassnameWithHttpInfo(body);
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ApiResponse of ModelClient</returns>
|
||||
public ApiResponse< ModelClient > TestClassnameWithHttpInfo (ModelClient body)
|
||||
{
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null)
|
||||
throw new ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname");
|
||||
|
||||
var localVarPath = "./fake_classname_test";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (body != null && body.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = body; // byte array
|
||||
}
|
||||
|
||||
// authentication (api_key_query) required
|
||||
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key_query")))
|
||||
{
|
||||
localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "api_key_query", Configuration.GetApiKeyWithPrefix("api_key_query")));
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath,
|
||||
Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestClassname", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<ModelClient>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
|
||||
(ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ModelClient</returns>
|
||||
public async System.Threading.Tasks.Task<ModelClient> TestClassnameAsync (ModelClient body)
|
||||
{
|
||||
ApiResponse<ModelClient> localVarResponse = await TestClassnameAsyncWithHttpInfo(body);
|
||||
return localVarResponse.Data;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ApiResponse (ModelClient)</returns>
|
||||
public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClassnameAsyncWithHttpInfo (ModelClient body)
|
||||
{
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null)
|
||||
throw new ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname");
|
||||
|
||||
var localVarPath = "./fake_classname_test";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (body != null && body.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = body; // byte array
|
||||
}
|
||||
|
||||
// authentication (api_key_query) required
|
||||
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key_query")))
|
||||
{
|
||||
localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "api_key_query", Configuration.GetApiKeyWithPrefix("api_key_query")));
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
|
||||
Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestClassname", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<ModelClient>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
|
||||
(ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -144,14 +144,7 @@ namespace IO.Swagger.Client
|
||||
|
||||
if (postBody != null) // http body (model or byte[]) parameter
|
||||
{
|
||||
if (postBody.GetType() == typeof(String))
|
||||
{
|
||||
request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = "application/json" });
|
||||
}
|
||||
else if (postBody.GetType() == typeof(byte[]))
|
||||
{
|
||||
request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = contentType });
|
||||
}
|
||||
request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = contentType });
|
||||
}
|
||||
|
||||
return request;
|
||||
@ -356,9 +349,25 @@ namespace IO.Swagger.Client
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///Check if the given MIME is a JSON MIME.
|
||||
///JSON MIME examples:
|
||||
/// application/json
|
||||
/// application/json; charset=UTF8
|
||||
/// APPLICATION/JSON
|
||||
/// application/vnd.company+json
|
||||
/// </summary>
|
||||
/// <param name="mime">MIME</param>
|
||||
/// <returns>Returns True if MIME type is json.</returns>
|
||||
public bool IsJsonMime(String mime)
|
||||
{
|
||||
var jsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||
return mime != null && (jsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select the Content-Type header's value from the given content-type array:
|
||||
/// if JSON exists in the given array, use it;
|
||||
/// if JSON type exists in the given array, use it;
|
||||
/// otherwise use the first one defined in 'consumes'
|
||||
/// </summary>
|
||||
/// <param name="contentTypes">The Content-Type array to select from.</param>
|
||||
@ -366,11 +375,14 @@ namespace IO.Swagger.Client
|
||||
public String SelectHeaderContentType(String[] contentTypes)
|
||||
{
|
||||
if (contentTypes.Length == 0)
|
||||
return null;
|
||||
|
||||
if (contentTypes.Contains("application/json", StringComparer.OrdinalIgnoreCase))
|
||||
return "application/json";
|
||||
|
||||
foreach (var contentType in contentTypes)
|
||||
{
|
||||
if (IsJsonMime(contentType.ToLower()))
|
||||
return contentType;
|
||||
}
|
||||
|
||||
return contentTypes[0]; // use the first content type specified in 'consumes'
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
./nuget
|
||||
|
||||
# Build results
|
||||
|
||||
|
@ -68,17 +68,18 @@ namespace Example
|
||||
public void main()
|
||||
{
|
||||
|
||||
var apiInstance = new FakeApi();
|
||||
var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional)
|
||||
var apiInstance = new AnotherFakeApi();
|
||||
var body = new ModelClient(); // ModelClient | client model
|
||||
|
||||
try
|
||||
{
|
||||
OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body);
|
||||
// To test special tags
|
||||
ModelClient result = apiInstance.TestSpecialTags(body);
|
||||
Debug.WriteLine(result);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message );
|
||||
Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message );
|
||||
}
|
||||
|
||||
}
|
||||
@ -93,6 +94,7 @@ 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 |
|
||||
@ -100,8 +102,9 @@ Class | Method | HTTP request | Description
|
||||
*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
|
||||
*Fake_classname_tags123Api* | [**TestClassname**](docs/Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||
*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
|
||||
|
@ -4,14 +4,43 @@
|
||||
#
|
||||
|
||||
frameworkVersion=net45
|
||||
netfx=${frameworkVersion#net}
|
||||
|
||||
# sdk must match installed framworks under PREFIX/lib/mono/[value]
|
||||
sdk=4.5.2-api
|
||||
|
||||
# langversion refers to C# language features. see man mcs for details.
|
||||
langversion=${sdk}
|
||||
nuget_cmd=nuget
|
||||
|
||||
# Match against our known SDK possibilities
|
||||
case "${sdk}" in
|
||||
4)
|
||||
langversion=4
|
||||
;;
|
||||
4.5*)
|
||||
langversion=5
|
||||
;;
|
||||
4.6*)
|
||||
langversion=6
|
||||
;;
|
||||
4.7*)
|
||||
langversion=7 # ignoring 7.1 for now.
|
||||
;;
|
||||
*)
|
||||
langversion=6
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "[INFO] Target framework: ${frameworkVersion}"
|
||||
|
||||
echo "[INFO] Download nuget and packages"
|
||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
|
||||
if [ ! type nuget &>/dev/null ]; then
|
||||
echo "[INFO] Download nuget and packages"
|
||||
wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe;
|
||||
nuget_cmd="mono nuget"
|
||||
fi
|
||||
|
||||
mozroots --import --sync
|
||||
mono nuget.exe install src/IO.Swagger/packages.config -o packages;
|
||||
${nuget_cmd} install src/IO.Swagger/packages.config -o packages;
|
||||
|
||||
echo "[INFO] Copy DLLs to the 'bin' folder"
|
||||
mkdir -p bin;
|
||||
@ -22,7 +51,7 @@ cp packages/PropertyChanged.Fody.1.51.3/PropertyChanged.Fody.dll bin/PropertyCha
|
||||
cp packages/PropertyChanged.Fody.1.51.3/Lib/dotnet/PropertyChanged.dll bin/PropertyChanged.dll
|
||||
|
||||
echo "[INFO] Run 'mcs' to build bin/IO.Swagger.dll"
|
||||
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
|
||||
mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,\
|
||||
bin/Fody.dll,\
|
||||
bin/PropertyChanged.Fody.dll,\
|
||||
bin/PropertyChanged.dll,\
|
||||
|
@ -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)
|
||||
|
@ -11,6 +11,7 @@ Method | HTTP request | Description
|
||||
[**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" 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
|
||||
|
||||
|
||||
@ -342,10 +343,10 @@ namespace Example
|
||||
Configuration.Default.Password = "YOUR_PASSWORD";
|
||||
|
||||
var apiInstance = new FakeApi();
|
||||
var number = 3.4; // decimal? | None
|
||||
var number = 8.14; // decimal? | None
|
||||
var _double = 1.2; // double? | None
|
||||
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
|
||||
var _byte = _byte_example; // byte[] | None
|
||||
var _byte = B; // byte[] | None
|
||||
var integer = 56; // int? | None (optional)
|
||||
var int32 = 56; // int? | None (optional)
|
||||
var int64 = 789; // long? | None (optional)
|
||||
@ -479,14 +480,70 @@ No authorization required
|
||||
|
||||
[[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;
|
||||
|
@ -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)
|
||||
|
@ -20,8 +20,6 @@ Method | HTTP request | Description
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -83,8 +81,6 @@ void (empty response body)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -342,8 +338,6 @@ Name | Type | Description | Notes
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -405,8 +399,6 @@ void (empty response body)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -472,8 +464,6 @@ void (empty response body)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -199,8 +199,6 @@ No authorization required
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -80,8 +80,6 @@ No authorization required
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -140,8 +138,6 @@ No authorization required
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -260,8 +256,6 @@ No authorization required
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -321,8 +315,6 @@ No authorization required
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
@ -384,8 +376,6 @@ No authorization required
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```csharp
|
||||
using System;
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,321 @@
|
||||
/*
|
||||
* 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.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using RestSharp;
|
||||
using IO.Swagger.Client;
|
||||
using IO.Swagger.Model;
|
||||
|
||||
namespace IO.Swagger.Api
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
public interface IAnotherFakeApi : IApiAccessor
|
||||
{
|
||||
#region Synchronous Operations
|
||||
/// <summary>
|
||||
/// To test special tags
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To test special tags
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ModelClient</returns>
|
||||
ModelClient TestSpecialTags (ModelClient body);
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To test special tags
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ApiResponse of ModelClient</returns>
|
||||
ApiResponse<ModelClient> TestSpecialTagsWithHttpInfo (ModelClient body);
|
||||
#endregion Synchronous Operations
|
||||
#region Asynchronous Operations
|
||||
/// <summary>
|
||||
/// To test special tags
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To test special tags
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ModelClient</returns>
|
||||
System.Threading.Tasks.Task<ModelClient> TestSpecialTagsAsync (ModelClient body);
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To test special tags
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ApiResponse (ModelClient)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestSpecialTagsAsyncWithHttpInfo (ModelClient body);
|
||||
#endregion Asynchronous Operations
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
public partial class AnotherFakeApi : IAnotherFakeApi
|
||||
{
|
||||
private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public AnotherFakeApi(String basePath)
|
||||
{
|
||||
this.Configuration = new Configuration { BasePath = basePath };
|
||||
|
||||
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnotherFakeApi"/> class
|
||||
/// using Configuration object
|
||||
/// </summary>
|
||||
/// <param name="configuration">An instance of Configuration</param>
|
||||
/// <returns></returns>
|
||||
public AnotherFakeApi(Configuration configuration = null)
|
||||
{
|
||||
if (configuration == null) // use the default one in Configuration
|
||||
this.Configuration = Configuration.Default;
|
||||
else
|
||||
this.Configuration = configuration;
|
||||
|
||||
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base path of the API client.
|
||||
/// </summary>
|
||||
/// <value>The base path</value>
|
||||
public String GetBasePath()
|
||||
{
|
||||
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the base path of the API client.
|
||||
/// </summary>
|
||||
/// <value>The base path</value>
|
||||
[Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
|
||||
public void SetBasePath(String basePath)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the configuration object
|
||||
/// </summary>
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a factory method hook for the creation of exceptions.
|
||||
/// </summary>
|
||||
public IO.Swagger.Client.ExceptionFactory ExceptionFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
|
||||
{
|
||||
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
|
||||
}
|
||||
return _exceptionFactory;
|
||||
}
|
||||
set { _exceptionFactory = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default header.
|
||||
/// </summary>
|
||||
/// <returns>Dictionary of HTTP header</returns>
|
||||
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
|
||||
public IDictionary<String, String> DefaultHeader()
|
||||
{
|
||||
return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add default header.
|
||||
/// </summary>
|
||||
/// <param name="key">Header field name.</param>
|
||||
/// <param name="value">Header field value.</param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
|
||||
public void AddDefaultHeader(string key, string value)
|
||||
{
|
||||
this.Configuration.AddDefaultHeader(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags To test special tags
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ModelClient</returns>
|
||||
public ModelClient TestSpecialTags (ModelClient body)
|
||||
{
|
||||
ApiResponse<ModelClient> localVarResponse = TestSpecialTagsWithHttpInfo(body);
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags To test special tags
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ApiResponse of ModelClient</returns>
|
||||
public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient body)
|
||||
{
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null)
|
||||
throw new ApiException(400, "Missing required parameter 'body' when calling AnotherFakeApi->TestSpecialTags");
|
||||
|
||||
var localVarPath = "/another-fake/dummy";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (body != null && body.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = body; // byte array
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath,
|
||||
Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<ModelClient>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||
(ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags To test special tags
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ModelClient</returns>
|
||||
public async System.Threading.Tasks.Task<ModelClient> TestSpecialTagsAsync (ModelClient body)
|
||||
{
|
||||
ApiResponse<ModelClient> localVarResponse = await TestSpecialTagsAsyncWithHttpInfo(body);
|
||||
return localVarResponse.Data;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test special tags To test special tags
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ApiResponse (ModelClient)</returns>
|
||||
public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestSpecialTagsAsyncWithHttpInfo (ModelClient body)
|
||||
{
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null)
|
||||
throw new ApiException(400, "Missing required parameter 'body' when calling AnotherFakeApi->TestSpecialTags");
|
||||
|
||||
var localVarPath = "/another-fake/dummy";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (body != null && body.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = body; // byte array
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
|
||||
Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<ModelClient>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||
(ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -212,6 +212,27 @@ namespace IO.Swagger.Api
|
||||
/// <returns>ApiResponse of Object(void)</returns>
|
||||
ApiResponse<Object> TestEnumParametersWithHttpInfo (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);
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns></returns>
|
||||
void TestInlineAdditionalProperties (Object param);
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>ApiResponse of Object(void)</returns>
|
||||
ApiResponse<Object> TestInlineAdditionalPropertiesWithHttpInfo (Object param);
|
||||
/// <summary>
|
||||
/// test json serialization of form data
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@ -424,6 +445,27 @@ namespace IO.Swagger.Api
|
||||
/// <returns>Task of ApiResponse</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<Object>> TestEnumParametersAsyncWithHttpInfo (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);
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of void</returns>
|
||||
System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync (Object param);
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of ApiResponse</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<Object>> TestInlineAdditionalPropertiesAsyncWithHttpInfo (Object param);
|
||||
/// <summary>
|
||||
/// test json serialization of form data
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
@ -1665,6 +1707,151 @@ namespace IO.Swagger.Api
|
||||
null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns></returns>
|
||||
public void TestInlineAdditionalProperties (Object param)
|
||||
{
|
||||
TestInlineAdditionalPropertiesWithHttpInfo(param);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>ApiResponse of Object(void)</returns>
|
||||
public ApiResponse<Object> TestInlineAdditionalPropertiesWithHttpInfo (Object param)
|
||||
{
|
||||
// verify the required parameter 'param' is set
|
||||
if (param == null)
|
||||
throw new ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestInlineAdditionalProperties");
|
||||
|
||||
var localVarPath = "/fake/inline-additionalProperties";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (param != null && param.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(param); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = param; // byte array
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath,
|
||||
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestInlineAdditionalProperties", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<Object>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||
null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of void</returns>
|
||||
public async System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync (Object param)
|
||||
{
|
||||
await TestInlineAdditionalPropertiesAsyncWithHttpInfo(param);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test inline additionalProperties
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="param">request body</param>
|
||||
/// <returns>Task of ApiResponse</returns>
|
||||
public async System.Threading.Tasks.Task<ApiResponse<Object>> TestInlineAdditionalPropertiesAsyncWithHttpInfo (Object param)
|
||||
{
|
||||
// verify the required parameter 'param' is set
|
||||
if (param == null)
|
||||
throw new ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestInlineAdditionalProperties");
|
||||
|
||||
var localVarPath = "/fake/inline-additionalProperties";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (param != null && param.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(param); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = param; // byte array
|
||||
}
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
|
||||
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestInlineAdditionalProperties", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<Object>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||
null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test json serialization of form data
|
||||
/// </summary>
|
||||
|
@ -0,0 +1,331 @@
|
||||
/*
|
||||
* 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.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using RestSharp;
|
||||
using IO.Swagger.Client;
|
||||
using IO.Swagger.Model;
|
||||
|
||||
namespace IO.Swagger.Api
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
public interface IFakeClassnameTags123Api : IApiAccessor
|
||||
{
|
||||
#region Synchronous Operations
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ModelClient</returns>
|
||||
ModelClient TestClassname (ModelClient body);
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ApiResponse of ModelClient</returns>
|
||||
ApiResponse<ModelClient> TestClassnameWithHttpInfo (ModelClient body);
|
||||
#endregion Synchronous Operations
|
||||
#region Asynchronous Operations
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ModelClient</returns>
|
||||
System.Threading.Tasks.Task<ModelClient> TestClassnameAsync (ModelClient body);
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ApiResponse (ModelClient)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClassnameAsyncWithHttpInfo (ModelClient body);
|
||||
#endregion Asynchronous Operations
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
public partial class FakeClassnameTags123Api : IFakeClassnameTags123Api
|
||||
{
|
||||
private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public FakeClassnameTags123Api(String basePath)
|
||||
{
|
||||
this.Configuration = new Configuration { BasePath = basePath };
|
||||
|
||||
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FakeClassnameTags123Api"/> class
|
||||
/// using Configuration object
|
||||
/// </summary>
|
||||
/// <param name="configuration">An instance of Configuration</param>
|
||||
/// <returns></returns>
|
||||
public FakeClassnameTags123Api(Configuration configuration = null)
|
||||
{
|
||||
if (configuration == null) // use the default one in Configuration
|
||||
this.Configuration = Configuration.Default;
|
||||
else
|
||||
this.Configuration = configuration;
|
||||
|
||||
ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base path of the API client.
|
||||
/// </summary>
|
||||
/// <value>The base path</value>
|
||||
public String GetBasePath()
|
||||
{
|
||||
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the base path of the API client.
|
||||
/// </summary>
|
||||
/// <value>The base path</value>
|
||||
[Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
|
||||
public void SetBasePath(String basePath)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the configuration object
|
||||
/// </summary>
|
||||
/// <value>An instance of the Configuration</value>
|
||||
public Configuration Configuration {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Provides a factory method hook for the creation of exceptions.
|
||||
/// </summary>
|
||||
public IO.Swagger.Client.ExceptionFactory ExceptionFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
|
||||
{
|
||||
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
|
||||
}
|
||||
return _exceptionFactory;
|
||||
}
|
||||
set { _exceptionFactory = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default header.
|
||||
/// </summary>
|
||||
/// <returns>Dictionary of HTTP header</returns>
|
||||
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
|
||||
public IDictionary<String, String> DefaultHeader()
|
||||
{
|
||||
return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add default header.
|
||||
/// </summary>
|
||||
/// <param name="key">Header field name.</param>
|
||||
/// <param name="value">Header field value.</param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
|
||||
public void AddDefaultHeader(string key, string value)
|
||||
{
|
||||
this.Configuration.AddDefaultHeader(key, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ModelClient</returns>
|
||||
public ModelClient TestClassname (ModelClient body)
|
||||
{
|
||||
ApiResponse<ModelClient> localVarResponse = TestClassnameWithHttpInfo(body);
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>ApiResponse of ModelClient</returns>
|
||||
public ApiResponse< ModelClient > TestClassnameWithHttpInfo (ModelClient body)
|
||||
{
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null)
|
||||
throw new ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname");
|
||||
|
||||
var localVarPath = "/fake_classname_test";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (body != null && body.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = body; // byte array
|
||||
}
|
||||
|
||||
// authentication (api_key_query) required
|
||||
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key_query")))
|
||||
{
|
||||
localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "api_key_query", Configuration.GetApiKeyWithPrefix("api_key_query")));
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath,
|
||||
Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestClassname", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<ModelClient>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||
(ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ModelClient</returns>
|
||||
public async System.Threading.Tasks.Task<ModelClient> TestClassnameAsync (ModelClient body)
|
||||
{
|
||||
ApiResponse<ModelClient> localVarResponse = await TestClassnameAsyncWithHttpInfo(body);
|
||||
return localVarResponse.Data;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// To test class name in snake case
|
||||
/// </summary>
|
||||
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="body">client model</param>
|
||||
/// <returns>Task of ApiResponse (ModelClient)</returns>
|
||||
public async System.Threading.Tasks.Task<ApiResponse<ModelClient>> TestClassnameAsyncWithHttpInfo (ModelClient body)
|
||||
{
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null)
|
||||
throw new ApiException(400, "Missing required parameter 'body' when calling FakeClassnameTags123Api->TestClassname");
|
||||
|
||||
var localVarPath = "/fake_classname_test";
|
||||
var localVarPathParams = new Dictionary<String, String>();
|
||||
var localVarQueryParams = new List<KeyValuePair<String, String>>();
|
||||
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||
var localVarFormParams = new Dictionary<String, String>();
|
||||
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||
Object localVarPostBody = null;
|
||||
|
||||
// to determine the Content-Type header
|
||||
String[] localVarHttpContentTypes = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||
|
||||
// to determine the Accept header
|
||||
String[] localVarHttpHeaderAccepts = new String[] {
|
||||
"application/json"
|
||||
};
|
||||
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||
if (localVarHttpHeaderAccept != null)
|
||||
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||
|
||||
if (body != null && body.GetType() != typeof(byte[]))
|
||||
{
|
||||
localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarPostBody = body; // byte array
|
||||
}
|
||||
|
||||
// authentication (api_key_query) required
|
||||
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key_query")))
|
||||
{
|
||||
localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "api_key_query", Configuration.GetApiKeyWithPrefix("api_key_query")));
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
|
||||
Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||
localVarPathParams, localVarHttpContentType);
|
||||
|
||||
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||
|
||||
if (ExceptionFactory != null)
|
||||
{
|
||||
Exception exception = ExceptionFactory("TestClassname", localVarResponse);
|
||||
if (exception != null) throw exception;
|
||||
}
|
||||
|
||||
return new ApiResponse<ModelClient>(localVarStatusCode,
|
||||
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||
(ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -139,14 +139,7 @@ namespace IO.Swagger.Client
|
||||
|
||||
if (postBody != null) // http body (model or byte[]) parameter
|
||||
{
|
||||
if (postBody.GetType() == typeof(String))
|
||||
{
|
||||
request.AddParameter("application/json", postBody, ParameterType.RequestBody);
|
||||
}
|
||||
else if (postBody.GetType() == typeof(byte[]))
|
||||
{
|
||||
request.AddParameter(contentType, postBody, ParameterType.RequestBody);
|
||||
}
|
||||
request.AddParameter(contentType, postBody, ParameterType.RequestBody);
|
||||
}
|
||||
|
||||
return request;
|
||||
@ -351,9 +344,25 @@ namespace IO.Swagger.Client
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///Check if the given MIME is a JSON MIME.
|
||||
///JSON MIME examples:
|
||||
/// application/json
|
||||
/// application/json; charset=UTF8
|
||||
/// APPLICATION/JSON
|
||||
/// application/vnd.company+json
|
||||
/// </summary>
|
||||
/// <param name="mime">MIME</param>
|
||||
/// <returns>Returns True if MIME type is json.</returns>
|
||||
public bool IsJsonMime(String mime)
|
||||
{
|
||||
var jsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
|
||||
return mime != null && (jsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select the Content-Type header's value from the given content-type array:
|
||||
/// if JSON exists in the given array, use it;
|
||||
/// if JSON type exists in the given array, use it;
|
||||
/// otherwise use the first one defined in 'consumes'
|
||||
/// </summary>
|
||||
/// <param name="contentTypes">The Content-Type array to select from.</param>
|
||||
@ -361,11 +370,14 @@ namespace IO.Swagger.Client
|
||||
public String SelectHeaderContentType(String[] contentTypes)
|
||||
{
|
||||
if (contentTypes.Length == 0)
|
||||
return null;
|
||||
|
||||
if (contentTypes.Contains("application/json", StringComparer.OrdinalIgnoreCase))
|
||||
return "application/json";
|
||||
|
||||
foreach (var contentType in contentTypes)
|
||||
{
|
||||
if (IsJsonMime(contentType.ToLower()))
|
||||
return contentType;
|
||||
}
|
||||
|
||||
return contentTypes[0]; // use the first content type specified in 'consumes'
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ class ObjectSerializer {
|
||||
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
||||
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
||||
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
||||
let transformedData = [];
|
||||
let transformedData: any[] = [];
|
||||
for (let index in data) {
|
||||
let date = data[index];
|
||||
transformedData.push(ObjectSerializer.serialize(date, subType));
|
||||
@ -90,7 +90,7 @@ class ObjectSerializer {
|
||||
|
||||
// get the map for the correct type.
|
||||
let attributeTypes = typeMap[type].getAttributeTypeMap();
|
||||
let instance = {};
|
||||
let instance: {[index: string]: any} = {};
|
||||
for (let index in attributeTypes) {
|
||||
let attributeType = attributeTypes[index];
|
||||
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
|
||||
@ -109,7 +109,7 @@ class ObjectSerializer {
|
||||
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
||||
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
||||
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
||||
let transformedData = [];
|
||||
let transformedData: any[] = [];
|
||||
for (let index in data) {
|
||||
let date = data[index];
|
||||
transformedData.push(ObjectSerializer.deserialize(date, subType));
|
||||
@ -406,12 +406,12 @@ export class User {
|
||||
}
|
||||
|
||||
|
||||
let enumsMap = {
|
||||
let enumsMap: {[index: string]: any} = {
|
||||
"Order.StatusEnum": Order.StatusEnum,
|
||||
"Pet.StatusEnum": Pet.StatusEnum,
|
||||
}
|
||||
|
||||
let typeMap = {
|
||||
let typeMap: {[index: string]: any} = {
|
||||
"ApiResponse": ApiResponse,
|
||||
"Category": Category,
|
||||
"Order": Order,
|
||||
@ -515,7 +515,7 @@ export class PetApi {
|
||||
}
|
||||
|
||||
public setApiKey(key: PetApiApiKeys, value: string) {
|
||||
this.authentications[PetApiApiKeys[key]].apiKey = value;
|
||||
(this.authentications as any)[PetApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
||||
set accessToken(token: string) {
|
||||
@ -1032,7 +1032,7 @@ export class StoreApi {
|
||||
}
|
||||
|
||||
public setApiKey(key: StoreApiApiKeys, value: string) {
|
||||
this.authentications[StoreApiApiKeys[key]].apiKey = value;
|
||||
(this.authentications as any)[StoreApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
||||
set accessToken(token: string) {
|
||||
@ -1290,7 +1290,7 @@ export class UserApi {
|
||||
}
|
||||
|
||||
public setApiKey(key: UserApiApiKeys, value: string) {
|
||||
this.authentications[UserApiApiKeys[key]].apiKey = value;
|
||||
(this.authentications as any)[UserApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
||||
set accessToken(token: string) {
|
||||
|
@ -36,7 +36,7 @@ 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."
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential 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
|
||||
|
@ -1,3 +1,6 @@
|
||||
/// <reference types="request" />
|
||||
/// <reference types="bluebird" />
|
||||
/// <reference types="node" />
|
||||
import localVarRequest = require('request');
|
||||
import http = require('http');
|
||||
import Promise = require('bluebird');
|
||||
@ -5,7 +8,7 @@ export declare class ApiResponse {
|
||||
'code': number;
|
||||
'type': string;
|
||||
'message': string;
|
||||
static discriminator: any;
|
||||
static discriminator: undefined;
|
||||
static attributeTypeMap: Array<{
|
||||
name: string;
|
||||
baseName: string;
|
||||
@ -20,7 +23,7 @@ export declare class ApiResponse {
|
||||
export declare class Category {
|
||||
'id': number;
|
||||
'name': string;
|
||||
static discriminator: any;
|
||||
static discriminator: undefined;
|
||||
static attributeTypeMap: Array<{
|
||||
name: string;
|
||||
baseName: string;
|
||||
@ -39,7 +42,7 @@ export declare class Order {
|
||||
'shipDate': Date;
|
||||
'status': Order.StatusEnum;
|
||||
'complete': boolean;
|
||||
static discriminator: any;
|
||||
static discriminator: undefined;
|
||||
static attributeTypeMap: Array<{
|
||||
name: string;
|
||||
baseName: string;
|
||||
@ -65,7 +68,7 @@ export declare class Pet {
|
||||
'photoUrls': Array<string>;
|
||||
'tags': Array<Tag>;
|
||||
'status': Pet.StatusEnum;
|
||||
static discriminator: any;
|
||||
static discriminator: undefined;
|
||||
static attributeTypeMap: Array<{
|
||||
name: string;
|
||||
baseName: string;
|
||||
@ -87,7 +90,7 @@ export declare namespace Pet {
|
||||
export declare class Tag {
|
||||
'id': number;
|
||||
'name': string;
|
||||
static discriminator: any;
|
||||
static discriminator: undefined;
|
||||
static attributeTypeMap: Array<{
|
||||
name: string;
|
||||
baseName: string;
|
||||
@ -108,7 +111,7 @@ export declare class User {
|
||||
'password': string;
|
||||
'phone': string;
|
||||
'userStatus': number;
|
||||
static discriminator: any;
|
||||
static discriminator: undefined;
|
||||
static attributeTypeMap: Array<{
|
||||
name: string;
|
||||
baseName: string;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -72,7 +72,7 @@ class ObjectSerializer {
|
||||
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
||||
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
||||
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
||||
let transformedData = [];
|
||||
let transformedData: any[] = [];
|
||||
for (let index in data) {
|
||||
let date = data[index];
|
||||
transformedData.push(ObjectSerializer.serialize(date, subType));
|
||||
@ -90,7 +90,7 @@ class ObjectSerializer {
|
||||
|
||||
// get the map for the correct type.
|
||||
let attributeTypes = typeMap[type].getAttributeTypeMap();
|
||||
let instance = {};
|
||||
let instance: {[index: string]: any} = {};
|
||||
for (let index in attributeTypes) {
|
||||
let attributeType = attributeTypes[index];
|
||||
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
|
||||
@ -109,7 +109,7 @@ class ObjectSerializer {
|
||||
} else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
||||
let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
|
||||
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
||||
let transformedData = [];
|
||||
let transformedData: any[] = [];
|
||||
for (let index in data) {
|
||||
let date = data[index];
|
||||
transformedData.push(ObjectSerializer.deserialize(date, subType));
|
||||
@ -406,12 +406,12 @@ export class User {
|
||||
}
|
||||
|
||||
|
||||
let enumsMap = {
|
||||
let enumsMap: {[index: string]: any} = {
|
||||
"Order.StatusEnum": Order.StatusEnum,
|
||||
"Pet.StatusEnum": Pet.StatusEnum,
|
||||
}
|
||||
|
||||
let typeMap = {
|
||||
let typeMap: {[index: string]: any} = {
|
||||
"ApiResponse": ApiResponse,
|
||||
"Category": Category,
|
||||
"Order": Order,
|
||||
@ -515,7 +515,7 @@ export class PetApi {
|
||||
}
|
||||
|
||||
public setApiKey(key: PetApiApiKeys, value: string) {
|
||||
this.authentications[PetApiApiKeys[key]].apiKey = value;
|
||||
(this.authentications as any)[PetApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
||||
set accessToken(token: string) {
|
||||
@ -1032,7 +1032,7 @@ export class StoreApi {
|
||||
}
|
||||
|
||||
public setApiKey(key: StoreApiApiKeys, value: string) {
|
||||
this.authentications[StoreApiApiKeys[key]].apiKey = value;
|
||||
(this.authentications as any)[StoreApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
||||
set accessToken(token: string) {
|
||||
@ -1290,7 +1290,7 @@ export class UserApi {
|
||||
}
|
||||
|
||||
public setApiKey(key: UserApiApiKeys, value: string) {
|
||||
this.authentications[UserApiApiKeys[key]].apiKey = value;
|
||||
(this.authentications as any)[UserApiApiKeys[key]].apiKey = value;
|
||||
}
|
||||
|
||||
set accessToken(token: string) {
|
||||
|
@ -1,14 +1,15 @@
|
||||
"use strict";
|
||||
var api = require('./api');
|
||||
var fs = require('fs');
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const api = require("./api");
|
||||
const fs = require("fs");
|
||||
function deepCheck(objectA, objectB) {
|
||||
var a = objectA;
|
||||
var b = objectB;
|
||||
var isString = (typeof a === "string" && typeof b === "string");
|
||||
var isBool = (typeof a === "boolean" && typeof b === "boolean");
|
||||
var isNumber = (typeof a === "number" && typeof b === "number");
|
||||
let a = objectA;
|
||||
let b = objectB;
|
||||
let isString = (typeof a === "string" && typeof b === "string");
|
||||
let isBool = (typeof a === "boolean" && typeof b === "boolean");
|
||||
let isNumber = (typeof a === "number" && typeof b === "number");
|
||||
if (a instanceof Array && b instanceof Array) {
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
for (let i = 0; i < a.length; i++) {
|
||||
if (!deepCheck(a[i], b[i])) {
|
||||
return false;
|
||||
}
|
||||
@ -19,7 +20,7 @@ function deepCheck(objectA, objectB) {
|
||||
return a === b;
|
||||
}
|
||||
else if (typeof a === "object" && typeof b === "object") {
|
||||
for (var key in a) {
|
||||
for (let key in a) {
|
||||
if (!deepCheck(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
@ -66,8 +67,8 @@ var deserializedPet = objectSerializer.deserialize(serializedPet, "Pet");
|
||||
var petType = deserializedPet instanceof rewiredApi.Pet;
|
||||
var tagType1 = deserializedPet.tags[0] instanceof rewiredApi.Tag;
|
||||
var categoryType = deserializedPet.category instanceof rewiredApi.Category;
|
||||
var checks = {};
|
||||
for (var key in deserializedPet) {
|
||||
let checks = {};
|
||||
for (let key in deserializedPet) {
|
||||
checks[key] = {};
|
||||
checks[key]["isCorrect"] = deepCheck(deserializedPet[key], serializedPet[key]);
|
||||
checks[key]["is"] = deserializedPet[key];
|
||||
@ -80,8 +81,8 @@ if (!correctTypes) {
|
||||
console.log("TagType1 correct: ", tagType1);
|
||||
console.log("CategoryType correct: ", categoryType);
|
||||
}
|
||||
for (var key in checks) {
|
||||
var check = checks[key];
|
||||
for (let key in checks) {
|
||||
let check = checks[key];
|
||||
if (!check["isCorrect"]) {
|
||||
exitCode = 1;
|
||||
console.log(key, " incorrect ", "\nis:\n ", check["is"], "\nshould:\n ", check["should"]);
|
||||
@ -98,29 +99,27 @@ if (!deepCheck(reserializedData, serializedPet)) {
|
||||
exitCode = 1;
|
||||
console.log("Reserialized Data incorrect! \nis:\n ", reserializedData, "\nshould:\n ", serializedPet);
|
||||
}
|
||||
pet.category = undefined;
|
||||
pet.status = undefined;
|
||||
petApi.addPet(pet)
|
||||
.then(function (res) {
|
||||
.then((res) => {
|
||||
var newPet = res.body;
|
||||
petId = newPet.id;
|
||||
console.log("Created pet with ID " + petId);
|
||||
console.log(`Created pet with ID ${petId}`);
|
||||
newPet.status = api.Pet.StatusEnum.Available;
|
||||
return petApi.updatePet(newPet);
|
||||
})
|
||||
.then(function (res) {
|
||||
.then((res) => {
|
||||
console.log('Updated pet using POST body');
|
||||
return petApi.updatePetWithForm(petId, undefined, "pending");
|
||||
})
|
||||
.then(function (res) {
|
||||
.then((res) => {
|
||||
console.log('Updated pet using POST form');
|
||||
return petApi.uploadFile(petId, undefined, fs.readFileSync('sample.png'));
|
||||
})
|
||||
.then(function (res) {
|
||||
.then((res) => {
|
||||
console.log('Uploaded image');
|
||||
return petApi.getPetById(petId);
|
||||
})
|
||||
.then(function (res) {
|
||||
.then((res) => {
|
||||
console.log('Got pet by ID: ' + JSON.stringify(res.body));
|
||||
console.log("EnumValue: ", api.Pet.StatusEnum.Pending);
|
||||
console.log("Typeof EnumValue:", typeof api.Pet.StatusEnum.Pending);
|
||||
@ -129,14 +128,14 @@ petApi.addPet(pet)
|
||||
throw new Error("Unexpected pet status");
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
exitCode = 1;
|
||||
})
|
||||
.then(function () {
|
||||
.then(() => {
|
||||
return petApi.deletePet(petId);
|
||||
})
|
||||
.then(function (res) {
|
||||
.then((res) => {
|
||||
console.log('Deleted pet');
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
@ -116,10 +116,6 @@ if (!deepCheck(reserializedData, serializedPet)) {
|
||||
"\nshould:\n ", serializedPet);
|
||||
}
|
||||
|
||||
// category and status are not used in the tests below.
|
||||
pet.category = undefined;
|
||||
pet.status = undefined;
|
||||
|
||||
// Test various API calls to the petstore
|
||||
petApi.addPet(pet)
|
||||
.then((res) => {
|
||||
|
@ -36,7 +36,7 @@ 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."
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential 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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,21 +5,22 @@
|
||||
"repository": "GIT_USER_ID/GIT_REPO_ID",
|
||||
"main": "api.js",
|
||||
"scripts": {
|
||||
"postinstall": "typings install",
|
||||
"clean": "rm -Rf node_modules/ typings/ *.js",
|
||||
"clean": "rm -Rf node_modules/ *.js",
|
||||
"build": "tsc",
|
||||
"test": "npm run build && node client.js"
|
||||
},
|
||||
"author": "Swagger Codegen Contributors",
|
||||
"license": "Unlicense",
|
||||
"dependencies": {
|
||||
"bluebird": "^3.3.5",
|
||||
"request": "^2.72.0",
|
||||
"@types/bluebird": "*",
|
||||
"@types/request": "*",
|
||||
"@types/rewire": "^2.5.28",
|
||||
"bluebird": "^3.5.0",
|
||||
"request": "^2.81.0",
|
||||
"rewire": "^2.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^1.8.10",
|
||||
"typings": "^0.8.1"
|
||||
"typescript": "^2.4.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://skimdb.npmjs.com/registry"
|
||||
|
@ -3,17 +3,17 @@
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": false,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"target": "ES5",
|
||||
"target": "ES6",
|
||||
"strict": true,
|
||||
"moduleResolution": "node",
|
||||
"removeComments": true,
|
||||
"sourceMap": true,
|
||||
"noLib": false,
|
||||
"declaration": true
|
||||
"declaration": true,
|
||||
"lib": ["dom", "es6", "es5", "dom.iterable", "scripthost"]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"typings/browser",
|
||||
"typings/browser.d.ts"
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
|
||||
"node": "registry:dt/node#4.0.0+20160423143914"
|
||||
},
|
||||
"dependencies": {
|
||||
"bluebird": "registry:npm/bluebird#3.3.4+20160515010139",
|
||||
"request": "registry:npm/request#2.69.0+20160304121250"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user